Search code examples
pythonpandasplothistogram

How to plot a Pandas dataframe by filtering a column


I have the following Pandas df:

Pandas dataframe

And I want to generate seven different histogram plots according to the weekday to show the attendance to a place in each hour of the day.

Thanks.


Solution

  • Here is an example for the weekday friday:

    import matplotlib.pyplot as plt
    
    plt.bar(x = 'at_what_time', height = 'visit_weight', data = df[df['weekday']=='friday'])