In [3]:
%matplotlib inline
import pandas as pd
In [4]:
from IPython.core.display import HTML
css = open('style-table.css').read() + open('style-notebook.css').read()
HTML('<style>{}</style>'.format(css))
Out[4]:
In [5]:
titles = pd.DataFrame.from_csv('data/titles.csv', index_col=None)
titles.head()
Out[5]:
In [6]:
cast = pd.DataFrame.from_csv('data/cast.csv', index_col=None)
cast.head()
Out[6]:
In [ ]:
In [7]:
t = titles
t.groupby(t.year // 10 * 10).size().plot(kind='bar')
Out[7]:
In [ ]:
In [8]:
t = titles[titles.title == "Hamlet"]
t.groupby(t.year // 10 * 10).size().plot(kind='bar')
Out[8]:
In [ ]:
In [17]:
c = cast
c = c[c.year // 10 == 195]
c = c[c.n == 1]
c.groupby(['year', 'type']).size()
Out[17]:
In [ ]:
In [18]:
c = cast
c = c[c.year // 10 == 195]
c = c[(c.n >= 1) & (c.n <=5)]
c.groupby(['year', 'n','type']).size()
Out[18]:
In [ ]:
In [23]:
c = cast
c = c[c.title == 'The Pink Panther']
c = c.sort('n').groupby(['year'])[['n']].max()
c
Out[23]:
In [ ]:
In [77]:
c = cast
c = c[c.name == 'Frank Oz']
g = c.groupby(['year','title']).size()
g[g > 1].order()
Out[77]:
In [ ]:
In [78]:
c = cast
c = c[c.name == 'Frank Oz']
g = c.groupby(['character']).size()
g[g > 2].order()
Out[78]:
In [ ]: