1- create a directroy mkdir jupyterworkflow
2- turn directory a package touch jupyterworkflow/initpy
3- create data file atom jupyterworkflow/data.py
4- put the function into the data.py file
In [1]:
%matplotlib inline
import matplotlib.pyplot as plt
plt.style.use('fivethirtyeight')
In [2]:
from jupyterworkflow.data import get_fremont_data
In [3]:
data = get_fremont_data()
data.head()
Out[3]:
In [4]:
data.plot()
Out[4]:
In [5]:
data.resample('W').sum().plot();
In [6]:
ax = data.resample('D').sum().rolling(365).sum().plot();
ax.set_ylim(0, None);
In [7]:
#trend in individual days
data.groupby(data.index.time).mean().plot();
In [8]:
pivoted = data.pivot_table('Total', index=data.index.time, columns=data.index.date)
pivoted.iloc[:5, :5]
Out[8]:
In [9]:
#line for each days of the year
pivoted.plot(legend=False, alpha=0.01);
In [10]:
get_fremont_data?
In [12]:
get_fremont_data??
In [ ]: