text: from IPython.display import YouTubeVideo, Image, HTML YouTubeVideo('0Q14rHLvMco')
  For some reason I've been thinking a lot about LOST lately--thinking about it enough that I rewatched the pilot a few nights ago. I got to thinking: how have all of the actors fared in their post-LOST careers? Despite it's trials and tribulations, did acting on LOST give a sense of purpose, just like Jack felt with the Island? Is it time yet for a career revitalizing LOST reboot?
  Normally these questions are relegated to some very simple slide show listicle. However, we don't have to settle for that! We've got data! We can perform a far more interesting analysis than googling "Matthew Fox."
  I scraped all of this data from IMDB, following the process below:
  Minor Roles: To eliminate minor roles, I only counted roles where that actor appeared on the main cast list for that movie/tv. For example: Jorge Garcia was in two episodes of How I Met Your Mother, but doesn't appear on the main HIMYM IMDB cast page.
  Year info: For TV shows, the year included is the year that TV show premiered. It's not the year in which an actor might have appeared on the show. For example: everyone who appeared in LOST will have a year of 2004, regardless of when they actually started on the show. Actors this impacts:
  Language: I'll use actors to refer to both actors and actresses throughout this exploration. I'll use the term media to refer to the general collection of TV or Movies.
  import pandas as pd %matplotlib inline
  we_have_to_go_back = pd.read_csv('./data/LOST_clean.csv') print "Total rows:", len(we_have_to_go_back) we_have_to_go_back.head()
  Total rows: 353
  We have 353 total rows listing the actor, the title of the media, the IMDB score, the year that media first aired, and the type of media. Let's first take a look at what different types of media we're working with.
  we_have_to_go_back['type'].value_counts()
  Movie 177 TV Movie 79 TV Series 55 Other/Unknown 23 Video Game 19 dtype: int64
  We're only going to include the data from Television or Film, and exclude Other/Unknown and Video Game.
  big_and_small_screen = we_have_to_go_back[(we_have_to_go_back['type'] == 'TV Series') | (we_have_to_go_back['type'] == 'Movie') | (we_have_to_go_back['type'] == 'TV Movie')]
  Now that we've got a clean dataset, let's get a little more information about the scores. LOST's IMDB score is an 8.5, but we have no context to understand whether that's high or low. (Sidebar: Here is a good analysis of the distribution of all IMDB scores)
  We've also got to remove the duplicates for this next step. LOST is listed 15 times (once for each actor) hence the spike around 8.5. We'll assume a duplicate is an item with the same title and score.
  Let's look at the distribution with a histogram, and also print out some summary statistics.
  big_and_small_screen.drop_duplicates(['title','score'])['score'].hist(bins=16) big_and_small_screen.drop_duplicates(['title','score'])['score'].describe()
  count 296.000000 mean 6.399324 std 1.059773 min 2.900000 25% 5.800000 50% 6.500000 75% 7.100000 max 9.000000 dtype: float64
  Comparing LOST's 8.5 score to these numbers shows us a few things:
  Also notice the top scored media for any actor is 9.0. Out of curiosity, let's take a look at the top 5 scored items in our dataset:
  big_and_small_screen.sort('score', ascending=0).head(5)
  Don't tell Terry O'Quinn what he can't do, because he can clearly star in a highly rated 1989 TV Movie.
  YouTubeVideo('arMtFxv7jlw')
  big_and_small_screen.ix[big_and_small_screen.groupby('actor')['score'].idxmax()]
  Of the 15 of the most frequent actors on LOST, only 2 of them have ever had a major role in something that has a score higher than LOST. Note that Person of Interest for Michael Emerson is rated the same as LOST, so we're excluding him from the club.
  We can also explore how many appearances each actor has had before and after LOST. In order to do that, we'll flag every entry as post-LOST if it started after 2004, then count the number of titles that come before or after.
  # side note: not happy with this code... there must be a better way. big_and_small_screen['post_lost'] = big_and_small_screen['start_year'] > 2004 before_and_after = pd.pivot_table(big_and_small_screen, columns=['post_lost'], values=['start_year'], index=['actor'], aggfunc=np.size).reset_index() before_and_after['more_after_lost'] = (before_and_after['start_year'][True] - before_and_after['start_year'][False] > 0) before_and_after
  9 out of 15 actors had more major roles after 2004. This is a pretty naive comparison, though, since a recurring role on a TV show is only going to count for 1, while an actor who chooses to go to the big screen is going to have multiple movies they're starring in. It also doesn't take into account things like Terry O'Quinn's massive 61 roles before LOST.
  On that note, let's see if there's a difference in what type of media the actors starred in before and after LOST. We'll count the number of Movies, TV, or TV Movies to each actors name before and after LOST, then see which of those categories is the highest.
  pre_LOST_roles = big_and_small_screen[big_and_small_screen['post_lost'] == False] actor_type_counts = pre_LOST_roles.groupby(['actor','type']).size().reset_index() actor_type_counts.columns = ['actor','type','occurrences'] actor_type_counts.ix[actor_type_counts.groupby('actor')['occurrences'].idxmax()]
  Note that these also include starring in LOST itself. Henry Ian Cusick is in good company with Terry O'Quinn as a major TV Movie actor! Alright!
  Let's quick tally tally up the types:
  actor_type_counts.ix[actor_type_counts.groupby('actor')['occurrences'].idxmax()]['type'].value_counts()
  Movie 9 TV Series 4 TV Movie 2 dtype: int64
  post_LOST_roles = big_and_small_screen[big_and_small_screen['post_lost'] == True] actor_type_counts = post_LOST_roles.groupby(['actor','type']).size().reset_index() actor_type_counts.columns = ['actor','type','occurrences'] actor_type_counts.ix[actor_type_counts.groupby('actor')['occurrences'].idxmax()]
  Everyone but Terry O'Quinn seemed to go to the big screen after LOST.
  Our quick, rudimentary analysis gave us some wonderful insight into the acting lives of 15 actors from LOST. Here's what we've learned: