How to create histogram of sales depending on day of week in Python?

Viewed 71

I have DataFrame in Python Pandas like below:

day_of_week| sales
-----------|------
4          | 140
6          | 500
3          | 234
...        | ...

Create histogram of sales depending on day of week. To be hones I do not understand how to make such a histogram and how to interpret the results because I don't understand what it is supposed to represent ?

1 Answers

Suppose the DataFrame looks like this. You can draw a bar plot to visualize the sales for each day.

days_of_week=[1,2,3,4,6,7,5]
sales_per_day = [140,43,23,45,67,89,700]
df=pd.DataFrame({"days_of_week":days_of_week,"sales_per_day":sales_per_day})
# Added red trend line
plt.figure(figsize=(10,5))
plt.bar(df.days_of_week,df.sales_per_day)
plt.plot(df.days_of_week,df.sales_per_day,color="red")
plt.show()
Related