In [ ]:
import pandas as pd

In [ ]:
cast = pd.DataFrame.from_csv('../data/intro/cast.csv.gz', index_col=None)

In [ ]:
cast.head()

In [ ]:

  • How many actors/actresses are credited in the movie Inception?

In [ ]:
len(cast[cast.title == 'Inception'])

In [ ]:

  • What are the names of the 4 leading character in the movie Inception and who plays them?

In [ ]:
cast[cast.title == 'Inception'].sort_values('n').head(4)[['character', 'name']]

In [ ]:

  • How many people have played a role called "The Stranger"?

In [ ]:
c = cast
c = c[c.character == 'The Stranger']
len(c)

In [ ]:

  • How many movies starts with C?

In [ ]:
titles = cast[['title', 'year']].drop_duplicates().reset_index(drop=True)
t = titles
t = t[t.title.str.startswith('C')]
t = t.sort_values('year', ascending=False)
t.head(10)

In [ ]:
len(t)

In [ ]:


In [ ]: