<jupyter_start><jupyter_text>Rolling and Expanding<jupyter_code>import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
dataframe = pd.read_csv('walmart_stock.csv',index_col='Date',parse_dates=True)
dataframe.head()
dataframe['Close'].plot(figsize=(14,5))
# rolling with windows size of every 7 days
dataframe.rolling(7).mean().head(10)
dataframe['Open'].plot()
dataframe.rolling(window=7).mean()['Close'].plot(figsize=(15,5))
dataframe['Open'].plot()
dataframe.rolling(window=30).mean()['Close'].plot(figsize=(15,5))<jupyter_output><empty_output><jupyter_text>Expanding<jupyter_code>#specify a minimum number of periods
dataframe['Close'].expanding(min_periods=1).mean().plot(figsize=(16,5))<jupyter_output><empty_output>
StarcoderdataJupyterStructuredCleanDedup