Skip to content
Advertisement

How to plot aggregated by date pandas dataframe

I have this dataframe

JavaScript

To aggregate payout_value by date I use:

JavaScript

How do I plot (bar chart) dates on x-axis and aggregated payout sum on y axis?

I tried using df.plot(x='date', y='payout_value',kind="bar") approach, but there is no ‘date’ column in df_daily dataframe, print(list(df_daily)) gives [('payout_value', 'sum')]

Advertisement

Answer

you are almost there, use reset_index and plot your by df_daily

JavaScript

enter image description here

Advertisement