Pandas group by time windows,df.groupby(df['date_time'].apply(my_grouper))