Skip to content Skip to sidebar Skip to footer

Apply Resampling To Each Group In A Groupby Object

I've created a convenience method to perform resampling on an arbitrary dataframe: def resample_data_to_hourly(df): df = df.resample('1H',how='mean',fill_method='ffill',

Solution 1:

data.groupby(level=0)
    .apply(lambda d: d.reset_index(level=0, drop=True)
                      .resample("M", how=""))

Post a Comment for "Apply Resampling To Each Group In A Groupby Object"