In [15]:
import os
from urllib.request import urlretrieve
import pandas as pd

URL = 'https://data.seattle.gov/api/views/65db-xm6k/rows.csv?accessType=DOWNLOAD'
def get_fremont_data(filename='Fremont.csv',url=URL, force_download=False):
    if force_download or not os.path.exists(filename):
        urlretrieve(URL, filename)
    data = pd.read_csv('Fremont.csv', index_col='Date', parse_dates=True)   
    data.columns = ['West','East']
    data['Total'] = data['West'] + data['East']
    return data

In [16]:
data = get_fremont_data()

In [17]:
data.head()


Out[17]:
West East Total
Date
2012-10-03 00:00:00 4.0 9.0 13.0
2012-10-03 01:00:00 4.0 6.0 10.0
2012-10-03 02:00:00 1.0 1.0 2.0
2012-10-03 03:00:00 2.0 3.0 5.0
2012-10-03 04:00:00 6.0 1.0 7.0

In [18]:
%matplotlib inline
data.plot()
data.resample('W').sum().plot()


Out[18]:
<matplotlib.axes._subplots.AxesSubplot at 0x1548e9ffdd8>

In [19]:
import seaborn as sns
sns.set()
data.resample('W').sum().plot()


Out[19]:
<matplotlib.axes._subplots.AxesSubplot at 0x1548f84db00>

In [20]:
ax = data.resample('D').rolling(365).sum().plot()
ax.set_ylim(0,None);


C:\Users\HRIDAY\Anaconda3\lib\site-packages\ipykernel\__main__.py:1: FutureWarning: 
.resample() is now a deferred operation
You called rolling(...) on this deferred object which materialized it into a dataframe
by implicitly taking the mean.  Use .resample(...).mean() instead
  if __name__ == '__main__':

In [21]:
data.groupby(data.index.time).mean().plot()


Out[21]:
<matplotlib.axes._subplots.AxesSubplot at 0x1548f4ce320>

In [22]:
pivoted = data.pivot_table('Total',index=data.index.time,columns=data.index.date)
pivoted.iloc[:5, :5]


Out[22]:
2012-10-03 2012-10-04 2012-10-05 2012-10-06 2012-10-07
00:00:00 13.0 18.0 11.0 15.0 11.0
01:00:00 10.0 3.0 8.0 15.0 17.0
02:00:00 2.0 9.0 7.0 9.0 3.0
03:00:00 5.0 3.0 4.0 3.0 6.0
04:00:00 7.0 8.0 9.0 5.0 3.0

In [23]:
pivoted.plot(legend=False,alpha=0.01)


Out[23]:
<matplotlib.axes._subplots.AxesSubplot at 0x1548e9612b0>