moving average trendline pandas code example
Example 1: rolling average df
df['pandas_SMA_3'] = df.iloc[:,1].rolling(window=3).mean()
Example 2: 12 month movinf average in python for dataframe
# Calculating the long-window simple moving average
long_rolling = data.rolling(window=100).mean()
long_rolling.tail()