Back to Browse

Data analysis with python and Pandas - Calculate Moving average of time series Tutorial 8

10.7K views
Aug 6, 2016
10:10

Visit complete course on Data Science with Python : https://www.udemy.com/data-science-with-python-and-pandas/?couponCode=YTSOCIAL090 For All other visit my udemy profile at : https://www.udemy.com/user/ankitmistry/ This video will explain how to calculate moving average of time series data with python pandas library rolling function. # # Calculate Moving average of Time series data # # 1, 4, 7, 9, 2, 4, 6, 7, 8 # ## (NAN+1)/2 (1+4)/2 (4+7)/2 (7+9)/2 (9+2)/2 # In[4]: import pandas as pd # In[7]: data1 = {'data':[1, 4, 7, 9, 2, 4, 6, 7, 8]} # In[8]: data1 # In[9]: df = pd.DataFrame(data1) # In[10]: df # In[12]: df1 = df.rolling(3).mean() df1 # In[13]: import matplotlib.pyplot as plt # In[14]: plt.plot(df['data']) plt.plot(df1['data']) plt.show()

Download

1 formats

Video Formats

360pmp410.9 MB

Right-click 'Download' and select 'Save Link As' if the file opens in a new tab.

Data analysis with python and Pandas - Calculate Moving average of time series Tutorial 8 | NatokHD