Python Pandas: Group datetime column into hour and minute aggregations

Can’t you do, where df is your DataFrame:

times = pd.to_datetime(df.timestamp_col)
df.groupby([times.dt.hour, times.dt.minute]).value_col.sum()

Leave a Comment