GoBlue_MathMan GoBlue_MathMan - 1 year ago 108
Python Question

Python Pandas Group by date using datetime data

I have a column

that I wish to groupby date time without creating a new column. Is this possible the current code I have does not work.

df = pd.groupby(df,by=[df['Date_Time'].date()])

Answer Source

Credit to @jezrael for his setup dataframe

You can set the index to be 'Date_Time' and use pd.TimeGrouper


enter image description here

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download