In [1]:
import pandas as pd
from pandas import DataFrame
import datetime
import pandas.io.data
import matplotlib.pyplot as plt
%matplotlib inline
In [2]:
df = pd.read_csv('weight.csv', index_col='date', parse_dates=True)
df.head()
Out[2]:
Compute a moving average of 14 days (2 weeks)
In [3]:
df['poundsMA'] = pd.rolling_mean(df['pounds'], 14)
In [4]:
df[['pounds','poundsMA']].plot(figsize=(20,10))
Out[4]:
In [4]: