MikeStark5656
MikeStark5656

Reputation: 13

Plot graph for only one specific value in a column

I am working with a dataset that looks at groceries, and the types of groceries, delivered at certain times of the day.

Dataset

I want to make a line graph of how much alcohol is delivered at certain hours of the day(order_hour_of_day, 0-23) as the y-axis, and the num_orders_hour as the x-axis. I know how to plot a graph between these columns but I am confused on how to only get the alcohol-related values

Upvotes: 0

Views: 4187

Answers (1)

Rabinzel
Rabinzel

Reputation: 7903

You can do something like this (really simplified):

import pandas as pd 
import matplotlib.pyplot as plt

df2 = df.loc[(df['department']=='alcohol') & (df['order_hour_of_day'] >= 0) & (df['order_hour_of_day'] <= 23), :]

plt.plot(df2['num_orders_hour'], df2['order_hour_of_day'])

Upvotes: 1

Related Questions