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]:
pounds
date
2014-09-18 20:35:00 165.40
2014-09-19 07:15:00 163.40
2014-09-19 22:50:00 167.80
2014-09-20 21:00:00 164.90
2014-09-21 20:15:00 164.24

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]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f0314dd90d0>

In [4]: