SyntaxFix
Write A Post
Hire A Developer
Questions
In case you are calculating more than one moving average:
for i in range(2,10): df['MA{}'.format(i)] = df.rolling(window=i).mean()
Then you can do an aggregate average of all the MA
df[[f for f in list(df) if "MA" in f]].mean(axis=1)