titles.tail()

len(titles)

"""
Explanation: How many movies are listed in the titles dataframe?
End of explanation
"""


titles.sort(columns='year', ascending=True).head()[:2]

"""
Explanation: What are the earliest two films listed in the titles dataframe?
End of explanation
"""


titles[titles['title'].str.contains('Hamlet')].sort('year')

"""
Explanation: How many movies have the title "Hamlet"?
End of explanation
"""


len(titles[titles.title == 'North by Northwest'])

"""
Explanation: How many movies are titled "North by Northwest"?
End of explanation
"""


titles[titles['title'] 'Hamlet'].sort('year')[:1]

"""
Explanation: When was the first movie titled "Hamlet" made?
End of explanation
"""


titles[titles.title == 'Treasure Island'].sort('year')

"""
Explanation: List all of the "Treasure Island" movies from earliest to most recent.
End of explanation
"""


len(titles[titles.year == 1950])

"""
Explanation: How many movies were made in the year 1950?
End of explanation
"""


movies_of_1960 = titles[titles.year == 1960]
len(movies_of_1960)

"""
Explanation: How many movies were made in the year 1960?
End of explanation
"""


moviesOf1950And1959 = titles[(titles.year >= 1950) & (titles.year <= 1950)]
len(moviesOf1950And1959)

"""
Explanation: How many movies were made from 1950 through 1959?
End of explanation
"""


titles.year.value_counts().sort_index().plot()

"""
Explanation: In what years has a movie titled "Batman" been released?
How many roles were there in the movie "Inception"?
How many roles in the movie "Inception" are NOT ranked by an "n" value?
But how many roles in the movie "Inception" did receive an "n" value?
Display the cast of "North by Northwest" in their correct "n"-value order, ignoring roles that did not earn a numeric "n" value.
Display the entire cast, in "n"-order, of the 1972 film "Sleuth".
Now display the entire cast, in "n"-order, of the 2007 version of "Sleuth".
How many roles were credited in the silent 1921 version of Hamlet?
How many roles were credited in Branagh’s 1996 Hamlet?
How many "Hamlet" roles have been listed in all film credits through history?
How many people have played an "Ophelia"?
How many people have played a role called "The Dude"?
How many people have played a role called "The Stranger"?
How many roles has Sidney Poitier played throughout his career?
How many roles has Judi Dench played?
List the supporting roles (having n=2) played by Cary Grant in the 1940s, in order by year.
List the leading roles that Cary Grant played in the 1940s in order by year.
How many roles were available for actors in the 1950s?
How many roles were avilable for actresses in the 1950s?
How many leading roles (n=1) were available from the beginning of film history through 1980?
How many non-leading roles were available through from the beginning of film history through 1980?
How many roles through 1980 were minor enough that they did not warrant a numeric "n" rank?
End of explanation
"""


