Llamada rodante en una columna y Groupby Second Pandas
df['rolling_mean'] = df.groupby('id')['value'].transform(lambda x: x.rolling(2).mean())
Horrible Hoopoe
df['rolling_mean'] = df.groupby('id')['value'].transform(lambda x: x.rolling(2).mean())