Given this dataframe:
df.head()
complete mid_c mid_h mid_l mid_o time
0 True 0.80936 0.80943 0.80936 0.80943 2018-01-31 09:54:10+00:00
1 True 0.80942 0.80942 0.80937 0.80937 2018-01-31 09:54:20+00:00
2 True 0.80946 0.80946 0.80946 0.80946 2018-01-31 09:54:25+00:00
3 True 0.80942 0.80942 0.80940 0.80940 2018-01-31 09:54:30+00:00
4 True 0.80944 0.80944 0.80944 0.80944 2018-01-31 09:54:35+00:00
Create a 50 moving average:
df['ma'] = df.mid_c.rolling(window=50).mean()
plot it:
df.plot('time', ['mid_c', 'ma'])
import matplotlib.pyplot as plt
plt.show()
solved Matplotlib graph adjusment with big dataset [closed]