79507083

Date: 2025-03-13 16:37:40
Score: 1
Natty:
Report link

Rolling operations on a groupby object automatically ignore NaNs in recent Pandas versions.

df.groupby('var1')['value'].rolling(3, min_periods=1).mean().reset_index(level=0, drop=True).sort_index()
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Hrithik Jyani