LernerPython blog, from Reuven Lerner: Pandas Grouper: Group datetime columns by custom time periods

Wait 5 sec.

Want to change the granularity when grouping on a Python Pandas data frame’s datetime column? Use Grouper. For example: Here we get the mean trip_distance per 14-day period:df.groupby(pd.Grouper(key='tpep_pickup_datetime', freq='14D'))['trip_distance'].mean()The post Pandas Grouper: Group datetime columns by custom time periods appeared first on LernerPython.