TMDb Movie Data - What contributes to making a genre popular?

Table of Contents

Introduction

What contributes to making a genre popular? This study uses the data set containing information from about 10,000 movies collected from The Movie Database (TMDb). This data set contains information on a list of movies including its popularity, adjusted budget, adjusted revenue, run time, release year, vote average and so on. This study evaluates how each of the factors listed in the previous sentence inpact the popularity of a movie's genre. Is there a correlation between each of these factors and the genre of the movie?

In [2]:
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
% matplotlib inline

Data Wrangling

General Properties

In [3]:
# Load data
df = pd.read_csv('tmdb-movies.csv')
pd.options.display.max_columns = None
display(df)
id imdb_id popularity budget revenue original_title cast homepage director tagline keywords overview runtime genres production_companies release_date vote_count vote_average release_year budget_adj revenue_adj
0 135397 tt0369610 32.985763 150000000 1513528810 Jurassic World Chris Pratt|Bryce Dallas Howard|Irrfan Khan|Vi... http://www.jurassicworld.com/ Colin Trevorrow The park is open. monster|dna|tyrannosaurus rex|velociraptor|island Twenty-two years after the events of Jurassic ... 124 Action|Adventure|Science Fiction|Thriller Universal Studios|Amblin Entertainment|Legenda... 6/9/15 5562 6.5 2015 1.379999e+08 1.392446e+09
1 76341 tt1392190 28.419936 150000000 378436354 Mad Max: Fury Road Tom Hardy|Charlize Theron|Hugh Keays-Byrne|Nic... http://www.madmaxmovie.com/ George Miller What a Lovely Day. future|chase|post-apocalyptic|dystopia|australia An apocalyptic story set in the furthest reach... 120 Action|Adventure|Science Fiction|Thriller Village Roadshow Pictures|Kennedy Miller Produ... 5/13/15 6185 7.1 2015 1.379999e+08 3.481613e+08
2 262500 tt2908446 13.112507 110000000 295238201 Insurgent Shailene Woodley|Theo James|Kate Winslet|Ansel... http://www.thedivergentseries.movie/#insurgent Robert Schwentke One Choice Can Destroy You based on novel|revolution|dystopia|sequel|dyst... Beatrice Prior must confront her inner demons ... 119 Adventure|Science Fiction|Thriller Summit Entertainment|Mandeville Films|Red Wago... 3/18/15 2480 6.3 2015 1.012000e+08 2.716190e+08
3 140607 tt2488496 11.173104 200000000 2068178225 Star Wars: The Force Awakens Harrison Ford|Mark Hamill|Carrie Fisher|Adam D... http://www.starwars.com/films/star-wars-episod... J.J. Abrams Every generation has a story. android|spaceship|jedi|space opera|3d Thirty years after defeating the Galactic Empi... 136 Action|Adventure|Science Fiction|Fantasy Lucasfilm|Truenorth Productions|Bad Robot 12/15/15 5292 7.5 2015 1.839999e+08 1.902723e+09
4 168259 tt2820852 9.335014 190000000 1506249360 Furious 7 Vin Diesel|Paul Walker|Jason Statham|Michelle ... http://www.furious7.com/ James Wan Vengeance Hits Home car race|speed|revenge|suspense|car Deckard Shaw seeks revenge against Dominic Tor... 137 Action|Crime|Thriller Universal Pictures|Original Film|Media Rights ... 4/1/15 2947 7.3 2015 1.747999e+08 1.385749e+09
5 281957 tt1663202 9.110700 135000000 532950503 The Revenant Leonardo DiCaprio|Tom Hardy|Will Poulter|Domhn... http://www.foxmovies.com/movies/the-revenant Alejandro González Iñárritu (n. One who has returned, as if from the dead.) father-son relationship|rape|based on novel|mo... In the 1820s, a frontiersman, Hugh Glass, sets... 156 Western|Drama|Adventure|Thriller Regency Enterprises|Appian Way|CatchPlay|Anony... 12/25/15 3929 7.2 2015 1.241999e+08 4.903142e+08
6 87101 tt1340138 8.654359 155000000 440603537 Terminator Genisys Arnold Schwarzenegger|Jason Clarke|Emilia Clar... http://www.terminatormovie.com/ Alan Taylor Reset the future saving the world|artificial intelligence|cybor... The year is 2029. John Connor, leader of the r... 125 Science Fiction|Action|Thriller|Adventure Paramount Pictures|Skydance Productions 6/23/15 2598 5.8 2015 1.425999e+08 4.053551e+08
7 286217 tt3659388 7.667400 108000000 595380321 The Martian Matt Damon|Jessica Chastain|Kristen Wiig|Jeff ... http://www.foxmovies.com/movies/the-martian Ridley Scott Bring Him Home based on novel|mars|nasa|isolation|botanist During a manned mission to Mars, Astronaut Mar... 141 Drama|Adventure|Science Fiction Twentieth Century Fox Film Corporation|Scott F... 9/30/15 4572 7.6 2015 9.935996e+07 5.477497e+08
8 211672 tt2293640 7.404165 74000000 1156730962 Minions Sandra Bullock|Jon Hamm|Michael Keaton|Allison... http://www.minionsmovie.com/ Kyle Balda|Pierre Coffin Before Gru, they had a history of bad bosses assistant|aftercreditsstinger|duringcreditssti... Minions Stuart, Kevin and Bob are recruited by... 91 Family|Animation|Adventure|Comedy Universal Pictures|Illumination Entertainment 6/17/15 2893 6.5 2015 6.807997e+07 1.064192e+09
9 150540 tt2096673 6.326804 175000000 853708609 Inside Out Amy Poehler|Phyllis Smith|Richard Kind|Bill Ha... http://movies.disney.com/inside-out Pete Docter Meet the little voices inside your head. dream|cartoon|imaginary friend|animation|kid Growing up can be a bumpy road, and it's no ex... 94 Comedy|Animation|Family Walt Disney Pictures|Pixar Animation Studios|W... 6/9/15 3935 8.0 2015 1.609999e+08 7.854116e+08
10 206647 tt2379713 6.200282 245000000 880674609 Spectre Daniel Craig|Christoph Waltz|Léa Seydoux|Ralp... http://www.sonypictures.com/movies/spectre/ Sam Mendes A Plan No One Escapes spy|based on novel|secret agent|sequel|james bond A cryptic message from Bond’s past sends him... 148 Action|Adventure|Crime Columbia Pictures|Danjaq|B24 10/26/15 3254 6.2 2015 2.253999e+08 8.102203e+08
11 76757 tt1617661 6.189369 176000003 183987723 Jupiter Ascending Mila Kunis|Channing Tatum|Sean Bean|Eddie Redm... http://www.jupiterascending.com Lana Wachowski|Lilly Wachowski Expand your universe. jupiter|space|woman director|3d|interspecies r... In a universe where human genetic material is ... 124 Science Fiction|Fantasy|Action|Adventure Village Roadshow Pictures|Dune Entertainment|A... 2/4/15 1937 5.2 2015 1.619199e+08 1.692686e+08
12 264660 tt0470752 6.118847 15000000 36869414 Ex Machina Domhnall Gleeson|Alicia Vikander|Oscar Isaac|S... http://exmachina-movie.com/ Alex Garland There is nothing more human than the will to s... dancing|artificial intelligence|helicopter|dis... Caleb, a 26 year old coder at the world's larg... 108 Drama|Science Fiction DNA Films|Universal Pictures International (UP... 1/21/15 2854 7.6 2015 1.379999e+07 3.391985e+07
13 257344 tt2120120 5.984995 88000000 243637091 Pixels Adam Sandler|Michelle Monaghan|Peter Dinklage|... http://www.pixels-movie.com/ Chris Columbus Game On. video game|nerd|alien attack|3d|pixels Video game experts are recruited by the milita... 105 Action|Comedy|Science Fiction Columbia Pictures|Happy Madison Productions 7/16/15 1575 5.8 2015 8.095996e+07 2.241460e+08
14 99861 tt2395427 5.944927 280000000 1405035767 Avengers: Age of Ultron Robert Downey Jr.|Chris Hemsworth|Mark Ruffalo... http://marvel.com/movies/movie/193/avengers_ag... Joss Whedon A New Age Has Come. marvel comic|comic|sequel|superhero|vision When Tony Stark tries to jumpstart a dormant p... 141 Action|Adventure|Science Fiction Marvel Studios|Prime Focus|Revolution Sun Studios 4/22/15 4304 7.4 2015 2.575999e+08 1.292632e+09
15 273248 tt3460252 5.898400 44000000 155760117 The Hateful Eight Samuel L. Jackson|Kurt Russell|Jennifer Jason ... http://thehatefuleight.com/ Quentin Tarantino No one comes up here without a damn good reason. bounty hunter|wyoming|mountains|hangman|voice ... Bounty hunters seek shelter from a raging bliz... 167 Crime|Drama|Mystery|Western Double Feature Films|The Weinstein Company|Fil... 12/25/15 2389 7.4 2015 4.047998e+07 1.432992e+08
16 260346 tt2446042 5.749758 48000000 325771424 Taken 3 Liam Neeson|Forest Whitaker|Maggie Grace|Famke... http://www.taken3movie.com/ Olivier Megaton It Ends Here revenge|murder|on the run|fugitive|framed Ex-government operative Bryan Mills finds his ... 109 Crime|Action|Thriller Twentieth Century Fox Film Corporation|M6 Film... 1/1/15 1578 6.1 2015 4.415998e+07 2.997096e+08
17 102899 tt0478970 5.573184 130000000 518602163 Ant-Man Paul Rudd|Michael Douglas|Evangeline Lilly|Cor... http://marvel.com/movies/movie/180/ant-man Peyton Reed Heroes Don't Get Any Bigger marvel comic|superhero|aftercreditsstinger|dur... Armed with the astonishing ability to shrink i... 115 Science Fiction|Action|Adventure Marvel Studios 7/14/15 3779 7.0 2015 1.195999e+08 4.771138e+08
18 150689 tt1661199 5.556818 95000000 542351353 Cinderella Lily James|Cate Blanchett|Richard Madden|Helen... NaN Kenneth Branagh Midnight is just the beginning. cinderella|magic|fairy tale|princess|shoe When her father unexpectedly passes away, youn... 112 Romance|Fantasy|Family|Drama Walt Disney Pictures|Genre Films|Beagle Pug Fi... 3/12/15 1495 6.8 2015 8.739996e+07 4.989630e+08
19 131634 tt1951266 5.476958 160000000 650523427 The Hunger Games: Mockingjay - Part 2 Jennifer Lawrence|Josh Hutcherson|Liam Hemswor... http://www.thehungergames.movie/ Francis Lawrence The fire will burn forever. revolution|strong woman|dystopia|game of death|3d With the nation of Panem in a full scale war, ... 136 War|Adventure|Science Fiction Studio Babelsberg|StudioCanal|Lionsgate|Walt D... 11/18/15 2380 6.5 2015 1.471999e+08 5.984813e+08
20 158852 tt1964418 5.462138 190000000 209035668 Tomorrowland Britt Robertson|George Clooney|Raffey Cassidy|... http://movies.disney.com/tomorrowland Brad Bird Imagine a world where nothing is impossible. inventor|apocalypse|destiny|imax|dreamer Bound by a shared destiny, a bright, optimisti... 130 Action|Family|Science Fiction|Adventure|Mystery Walt Disney Pictures|Babieka|A113 5/19/15 1899 6.2 2015 1.747999e+08 1.923127e+08
21 307081 tt1798684 5.337064 30000000 91709827 Southpaw Jake Gyllenhaal|Rachel McAdams|Forest Whitaker... NaN Antoine Fuqua Believe in Hope. sport Billy "The Great" Hope, the reigning junior mi... 123 Action|Drama Escape Artists|Riche-Ludwig Productions 6/15/15 1386 7.3 2015 2.759999e+07 8.437300e+07
22 254128 tt2126355 4.907832 110000000 470490832 San Andreas Dwayne Johnson|Alexandra Daddario|Carla Gugino... http://www.sanandreasmovie.com/ Brad Peyton A rescue pilot survived an earthquake, this is... california|earthquake|catastrophe|disaster fil... In the aftermath of a massive earthquake in Ca... 114 Action|Drama|Thriller New Line Cinema|Village Roadshow Pictures|Warn... 5/27/15 2060 6.1 2015 1.012000e+08 4.328514e+08
23 216015 tt2322441 4.710402 40000000 569651467 Fifty Shades of Grey Dakota Johnson|Jamie Dornan|Jennifer Ehle|Eloi... https://www.facebook.com/fiftyshadesofgreymovie Sam Taylor-Johnson Are you curious? based on novel|billionaire|bdsm|woman director... When college senior Anastasia Steele steps in ... 125 Drama|Romance Focus Features|Trigger Street Productions|Mich... 2/11/15 1865 5.3 2015 3.679998e+07 5.240791e+08
24 318846 tt1596363 4.648046 28000000 133346506 The Big Short Christian Bale|Steve Carell|Ryan Gosling|Brad ... http://www.thebigshortmovie.com/ Adam McKay This is a true story. bank|fraud|biography|wall street|finances The men who made millions from a global econom... 130 Comedy|Drama Paramount Pictures|Plan B Entertainment|Regenc... 12/11/15 1545 7.3 2015 2.575999e+07 1.226787e+08
25 177677 tt2381249 4.566713 150000000 682330139 Mission: Impossible - Rogue Nation Tom Cruise|Jeremy Renner|Simon Pegg|Rebecca Fe... http://www.missionimpossible.com Christopher McQuarrie Desperate Times. Desperate Measures. spy|sequel|mission Ethan and team take on their most impossible m... 131 Action Paramount Pictures|Skydance Productions|China ... 7/23/15 2349 7.1 2015 1.379999e+08 6.277435e+08
26 214756 tt2637276 4.564549 68000000 215863606 Ted 2 Mark Wahlberg|Seth MacFarlane|Amanda Seyfried|... NaN Seth MacFarlane Ted is Coming, Again. sperm bank|sequel|buddy|courthouse|teddy bear Newlywed couple Ted and Tami-Lynn want to have... 115 Comedy Universal Pictures|Media Rights Capital|Fuzzy ... 6/25/15 1666 6.3 2015 6.255997e+07 1.985944e+08
27 207703 tt2802144 4.503789 81000000 403802136 Kingsman: The Secret Service Taron Egerton|Colin Firth|Samuel L. Jackson|Mi... http://www.kingsmanmovie.com/ Matthew Vaughn Manners maketh man. spy|great britain|secret organization|secret a... The story of a super-secret spy organization t... 130 Crime|Comedy|Action|Adventure Twentieth Century Fox Film Corporation|Marv Fi... 1/24/15 3833 7.6 2015 7.451997e+07 3.714978e+08
28 314365 tt1895587 4.062293 20000000 88346473 Spotlight Mark Ruffalo|Michael Keaton|Rachel McAdams|Lie... http://www.spotlightthefilm.com Tom McCarthy Break the story. Break the silence. child abuse|journalism|judge|florida|boston The true story of how The Boston Globe uncover... 128 Drama|Thriller|History Participant Media|Open Road Films|Anonymous Co... 11/6/15 1559 7.8 2015 1.839999e+07 8.127872e+07
29 294254 tt4046784 3.968891 61000000 311256926 Maze Runner: The Scorch Trials Dylan O'Brien|Kaya Scodelario|Thomas Brodie-Sa... http://mazerunnermovies.com Wes Ball The Maze Was Just the Beginning. based on novel|resistance|maze|post-apocalypti... Thomas and his fellow Gladers face their great... 132 Action|Science Fiction|Thriller Gotham Group|Temple Hill Entertainment|TSG Ent... 9/9/15 1849 6.4 2015 5.611998e+07 2.863562e+08
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
10836 38720 tt0061170 0.239435 0 0 Walk Don't Run Cary Grant|Samantha Eggar|Jim Hutton|John Stan... NaN Charles Walters Run, don't walk to see Walk, Don't Run. hotel room|embassy|olympics|housing shortage British industrialist Sir William Rutland - "B... 114 Comedy|Romance Columbia Pictures Corporation 1/1/66 11 5.8 1966 0.000000e+00 0.000000e+00
10837 19728 tt0060177 0.291704 0 0 The Blue Max George Peppard|James Mason|Ursula Andress|Jere... NaN John Guillermin There was no quiet on the Western Front! world war i|fighter pilot|biplane|flying ace A young pilot in the German air force of 1918,... 156 War|Action|Adventure|Drama Twentieth Century Fox Film Corporation 6/21/66 12 5.5 1966 0.000000e+00 0.000000e+00
10838 22383 tt0060862 0.151845 0 0 The Professionals Burt Lancaster|Lee Marvin|Robert Ryan|Woody St... NaN Richard Brooks Rough, tough and ready. mexico|kidnapper|plan|rescue|desert The Professionals is a 1966 American Western f... 117 Action|Adventure|Western Columbia Pictures 11/1/66 21 6.0 1966 0.000000e+00 0.000000e+00
10839 13353 tt0060550 0.276133 0 0 It's the Great Pumpkin, Charlie Brown Christopher Shea|Sally Dryer|Kathy Steinberg|A... NaN Bill Melendez Every year he rises from the pumpkin patch... holiday This classic "Peanuts" tale focuses on the thu... 25 Family|Animation Warner Bros. Home Video 10/27/66 49 7.2 1966 0.000000e+00 0.000000e+00
10840 34388 tt0060437 0.102530 0 0 Funeral in Berlin Michael Caine|Paul Hubschmid|Oskar Homolka|Eva... NaN Guy Hamilton NaN berlin|berlin wall|england|spy|cold war Colonel Stok, a Soviet intelligence officer re... 102 Thriller Lowndes Productions Limited 12/22/66 13 5.7 1966 0.000000e+00 0.000000e+00
10841 42701 tt0062262 0.264925 75000 0 The Shooting Will Hutchins|Millie Perkins|Jack Nicholson|Wa... NaN Monte Hellman Suspenseful desert pursuit in the "High Noon" ... horseback riding|revenge|pursuit|desert|whistling A hired gun seeks to enact revenge on a group ... 82 Western Proteus Films 10/23/66 12 5.5 1966 5.038511e+05 0.000000e+00
10842 36540 tt0061199 0.253437 0 0 Winnie the Pooh and the Honey Tree Sterling Holloway|Junius Matthews|Sebastian Ca... NaN Wolfgang Reitherman NaN NaN Christopher Robin's bear attempts to raid a be... 25 Animation|Family NaN 1/1/66 12 7.9 1966 0.000000e+00 0.000000e+00
10843 29710 tt0060588 0.252399 0 0 Khartoum Charlton Heston|Laurence Olivier|Richard Johns... NaN Basil Dearden|Eliot Elisofon Where the Nile divides, the great Cinerama adv... islam|siege|sudan|epic|victorian england English General Charles George Gordon, a devou... 134 Adventure|Drama|War|History|Action Julian Blaustein Productions Ltd. 6/9/66 12 5.8 1966 0.000000e+00 0.000000e+00
10844 23728 tt0059557 0.236098 0 0 Our Man Flint James Coburn|Lee J. Cobb|Gila Golan|Edward Mul... NaN Daniel Mann The ORIGINAL man of mystery! spy|spoof|derek flint|super spy When scientists use eco-terrorism to impose th... 108 Adventure|Comedy|Fantasy|Science Fiction 20th Century Fox 1/16/66 13 5.6 1966 0.000000e+00 0.000000e+00
10845 5065 tt0059014 0.230873 0 0 Carry On Cowboy Sid James|Jim Dale|Angela Douglas|Kenneth Will... NaN Gerald Thomas How the west was lost! washington d.c.|carry on Stodge City is in the grip of the Rumpo Kid an... 93 Comedy|Western Peter Rogers Productions 3/1/66 15 5.9 1966 0.000000e+00 0.000000e+00
10846 17102 tt0059127 0.212716 0 0 Dracula: Prince of Darkness Christopher Lee|Barbara Shelley|Andrew Keir|Fr... NaN Terence Fisher DEAD for Ten Years DRACULA, Prince of Darkness... castle|vampire|dracula|sequel|blood Whilst vacationing in the Carpathian Mountain,... 90 Horror Seven Arts Productions|Hammer Film Productions 1/9/66 16 5.7 1966 0.000000e+00 0.000000e+00
10847 28763 tt0060548 0.034555 0 0 Island of Terror Peter Cushing|Edward Judd|Carole Gray|Eddie By... NaN Terence Fisher How could they stop the devouring death...that... monster|island|fog|bone|creature A small island community is overrun with creep... 89 Science Fiction|Horror Planet Film Productions|Protelco 6/20/66 13 5.3 1966 0.000000e+00 0.000000e+00
10848 2161 tt0060397 0.207257 5115000 12000000 Fantastic Voyage Stephen Boyd|Raquel Welch|Edmond O'Brien|Donal... NaN Richard Fleischer A Fantastic and Spectacular Voyage... Through ... submarine|coma|claustrophobia|wound|laser The science of miniaturization has been unlock... 100 Adventure|Science Fiction Twentieth Century Fox Film Corporation 8/24/66 42 6.7 1966 3.436265e+07 8.061618e+07
10849 28270 tt0060445 0.206537 0 0 Gambit Michael Caine|Shirley MacLaine|Herbert Lom|Joh... NaN Ronald Neame Shirley MacLaine raises Michael Caine! master thief Harry Dean (Michael Caine) has a perfect plan ... 109 Action|Comedy|Crime Universal Pictures 12/16/66 14 6.1 1966 0.000000e+00 0.000000e+00
10850 26268 tt0060490 0.202473 0 0 Harper Paul Newman|Lauren Bacall|Julie Harris|Arthur ... NaN Jack Smight Harper takes a case - and the payoff is murder. private eye|lew harper Harper is a cynical private eye in the best tr... 121 Action|Drama|Thriller|Crime|Mystery Warner Bros. 2/23/66 14 6.0 1966 0.000000e+00 0.000000e+00
10851 15347 tt0060182 0.342791 0 0 Born Free Virginia McKenna|Bill Travers|Geoffrey Keen|Pe... NaN James Hill From The Pages Of The Beloved Best Seller... A... parents kids relationship|famous score|lion|ag... Born Free (1966) is an Open Road Films Ltd./Co... 95 Adventure|Drama|Action|Family|Foreign High Road 6/22/66 15 6.6 1966 0.000000e+00 0.000000e+00
10852 37301 tt0060165 0.227220 0 0 A Big Hand for the Little Lady Henry Fonda|Joanne Woodward|Jason Robards|Paul... NaN Fielder Cook All the action you can take...all the adventur... poker game A naive traveler in Laredo gets involved in a ... 95 Western Eden Productions Inc. 5/31/66 11 6.0 1966 0.000000e+00 0.000000e+00
10853 15598 tt0060086 0.163592 0 0 Alfie Michael Caine|Shelley Winters|Millicent Martin... NaN Lewis Gilbert Is any man an Alfie? Ask any girl! womanizer|playboy The film tells the story of a young man who le... 114 Comedy|Drama|Romance NaN 3/29/66 26 6.2 1966 0.000000e+00 0.000000e+00
10854 31602 tt0060232 0.146402 0 0 The Chase Marlon Brando|Jane Fonda|Robert Redford|E.G. M... NaN Arthur Penn The chase is on! sheriff|house party|man hunt|junkyard|jump fro... Most everyone in town thinks that Sheriff Cald... 135 Thriller|Drama|Crime Horizon Pictures|Columbia Pictures Corporation 2/17/66 17 6.0 1966 0.000000e+00 0.000000e+00
10855 13343 tt0059221 0.141026 700000 0 The Ghost & Mr. Chicken Don Knotts|Joan Staley|Liam Redmond|Dick Sarge... NaN Alan Rafkin G-G-GUARANTEED! YOU'LL BE SCARED UNTIL YOU LAU... newspaper|haunted house|organ|slapstick|trial Luther Heggs aspires to being a reporter for h... 90 Comedy|Family|Mystery|Romance Universal Pictures 1/20/66 14 6.1 1966 4.702610e+06 0.000000e+00
10856 20277 tt0061135 0.140934 0 0 The Ugly Dachshund Dean Jones|Suzanne Pleshette|Charles Ruggles|K... NaN Norman Tokar A HAPPY HONEYMOON GOES TO THE DOGS!...When a G... great dane|dachshund The Garrisons (Dean Jones and Suzanne Pleshett... 93 Comedy|Drama|Family Walt Disney Pictures 2/16/66 14 5.7 1966 0.000000e+00 0.000000e+00
10857 5921 tt0060748 0.131378 0 0 Nevada Smith Steve McQueen|Karl Malden|Brian Keith|Arthur K... NaN Henry Hathaway Some called him savage- and some called him sa... repayment|revenge|native american|wild west|ha... Nevada Smith is the young son of an Indian mot... 128 Action|Western Paramount Pictures|Solar Productions|Embassy P... 6/10/66 10 5.9 1966 0.000000e+00 0.000000e+00
10858 31918 tt0060921 0.317824 0 0 The Russians Are Coming, The Russians Are Coming Carl Reiner|Eva Marie Saint|Alan Arkin|Brian K... NaN Norman Jewison IT'S A PLOT! ...to make the world die laughing!! cold war|russian|new england Without hostile intent, a Soviet sub runs agro... 126 Comedy|War The Mirisch Corporation 5/25/66 11 5.5 1966 0.000000e+00 0.000000e+00
10859 20620 tt0060955 0.089072 0 0 Seconds Rock Hudson|Salome Jens|John Randolph|Will Gee... NaN John Frankenheimer NaN plastic surgery|suspense A secret organisation offers wealthy people a ... 100 Mystery|Science Fiction|Thriller|Drama Gibraltar Productions|Joel Productions|John Fr... 10/5/66 22 6.6 1966 0.000000e+00 0.000000e+00
10860 5060 tt0060214 0.087034 0 0 Carry On Screaming! Kenneth Williams|Jim Dale|Harry H. Corbett|Joa... NaN Gerald Thomas Carry On Screaming with the Hilarious CARRY ON... monster|carry on|horror spoof The sinister Dr Watt has an evil scheme going.... 87 Comedy Peter Rogers Productions|Anglo-Amalgamated Fil... 5/20/66 13 7.0 1966 0.000000e+00 0.000000e+00
10861 21 tt0060371 0.080598 0 0 The Endless Summer Michael Hynson|Robert August|Lord 'Tally Ho' B... NaN Bruce Brown NaN surfer|surfboard|surfing The Endless Summer, by Bruce Brown, is one of ... 95 Documentary Bruce Brown Films 6/15/66 11 7.4 1966 0.000000e+00 0.000000e+00
10862 20379 tt0060472 0.065543 0 0 Grand Prix James Garner|Eva Marie Saint|Yves Montand|Tosh... NaN John Frankenheimer Cinerama sweeps YOU into a drama of speed and ... car race|racing|formula 1 Grand Prix driver Pete Aron is fired by his te... 176 Action|Adventure|Drama Cherokee Productions|Joel Productions|Douglas ... 12/21/66 20 5.7 1966 0.000000e+00 0.000000e+00
10863 39768 tt0060161 0.065141 0 0 Beregis Avtomobilya Innokentiy Smoktunovskiy|Oleg Efremov|Georgi Z... NaN Eldar Ryazanov NaN car|trolley|stealing car An insurance agent who moonlights as a carthie... 94 Mystery|Comedy Mosfilm 1/1/66 11 6.5 1966 0.000000e+00 0.000000e+00
10864 21449 tt0061177 0.064317 0 0 What's Up, Tiger Lily? Tatsuya Mihashi|Akiko Wakabayashi|Mie Hama|Joh... NaN Woody Allen WOODY ALLEN STRIKES BACK! spoof In comic Woody Allen's film debut, he took the... 80 Action|Comedy Benedict Pictures Corp. 11/2/66 22 5.4 1966 0.000000e+00 0.000000e+00
10865 22293 tt0060666 0.035919 19000 0 Manos: The Hands of Fate Harold P. Warren|Tom Neyman|John Reynolds|Dian... NaN Harold P. Warren It's Shocking! It's Beyond Your Imagination! fire|gun|drive|sacrifice|flashlight A family gets lost on the road and stumbles up... 74 Horror Norm-Iris 11/15/66 15 1.5 1966 1.276423e+05 0.000000e+00

10866 rows × 21 columns

In [4]:
# What is the shape of this data frame?
df.shape
Out[4]:
(10866, 21)
In [5]:
# Summary Statistics
df.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 10866 entries, 0 to 10865
Data columns (total 21 columns):
id                      10866 non-null int64
imdb_id                 10856 non-null object
popularity              10866 non-null float64
budget                  10866 non-null int64
revenue                 10866 non-null int64
original_title          10866 non-null object
cast                    10790 non-null object
homepage                2936 non-null object
director                10822 non-null object
tagline                 8042 non-null object
keywords                9373 non-null object
overview                10862 non-null object
runtime                 10866 non-null int64
genres                  10843 non-null object
production_companies    9836 non-null object
release_date            10866 non-null object
vote_count              10866 non-null int64
vote_average            10866 non-null float64
release_year            10866 non-null int64
budget_adj              10866 non-null float64
revenue_adj             10866 non-null float64
dtypes: float64(4), int64(6), object(11)
memory usage: 1.7+ MB

Data Cleaning

In [6]:
# Only grab the columns that we want to analyze
df = df[["genres", "popularity", "vote_average", "runtime", "budget_adj", "revenue_adj", "release_year"]]
df
Out[6]:
genres popularity vote_average runtime budget_adj revenue_adj release_year
0 Action|Adventure|Science Fiction|Thriller 32.985763 6.5 124 1.379999e+08 1.392446e+09 2015
1 Action|Adventure|Science Fiction|Thriller 28.419936 7.1 120 1.379999e+08 3.481613e+08 2015
2 Adventure|Science Fiction|Thriller 13.112507 6.3 119 1.012000e+08 2.716190e+08 2015
3 Action|Adventure|Science Fiction|Fantasy 11.173104 7.5 136 1.839999e+08 1.902723e+09 2015
4 Action|Crime|Thriller 9.335014 7.3 137 1.747999e+08 1.385749e+09 2015
5 Western|Drama|Adventure|Thriller 9.110700 7.2 156 1.241999e+08 4.903142e+08 2015
6 Science Fiction|Action|Thriller|Adventure 8.654359 5.8 125 1.425999e+08 4.053551e+08 2015
7 Drama|Adventure|Science Fiction 7.667400 7.6 141 9.935996e+07 5.477497e+08 2015
8 Family|Animation|Adventure|Comedy 7.404165 6.5 91 6.807997e+07 1.064192e+09 2015
9 Comedy|Animation|Family 6.326804 8.0 94 1.609999e+08 7.854116e+08 2015
10 Action|Adventure|Crime 6.200282 6.2 148 2.253999e+08 8.102203e+08 2015
11 Science Fiction|Fantasy|Action|Adventure 6.189369 5.2 124 1.619199e+08 1.692686e+08 2015
12 Drama|Science Fiction 6.118847 7.6 108 1.379999e+07 3.391985e+07 2015
13 Action|Comedy|Science Fiction 5.984995 5.8 105 8.095996e+07 2.241460e+08 2015
14 Action|Adventure|Science Fiction 5.944927 7.4 141 2.575999e+08 1.292632e+09 2015
15 Crime|Drama|Mystery|Western 5.898400 7.4 167 4.047998e+07 1.432992e+08 2015
16 Crime|Action|Thriller 5.749758 6.1 109 4.415998e+07 2.997096e+08 2015
17 Science Fiction|Action|Adventure 5.573184 7.0 115 1.195999e+08 4.771138e+08 2015
18 Romance|Fantasy|Family|Drama 5.556818 6.8 112 8.739996e+07 4.989630e+08 2015
19 War|Adventure|Science Fiction 5.476958 6.5 136 1.471999e+08 5.984813e+08 2015
20 Action|Family|Science Fiction|Adventure|Mystery 5.462138 6.2 130 1.747999e+08 1.923127e+08 2015
21 Action|Drama 5.337064 7.3 123 2.759999e+07 8.437300e+07 2015
22 Action|Drama|Thriller 4.907832 6.1 114 1.012000e+08 4.328514e+08 2015
23 Drama|Romance 4.710402 5.3 125 3.679998e+07 5.240791e+08 2015
24 Comedy|Drama 4.648046 7.3 130 2.575999e+07 1.226787e+08 2015
25 Action 4.566713 7.1 131 1.379999e+08 6.277435e+08 2015
26 Comedy 4.564549 6.3 115 6.255997e+07 1.985944e+08 2015
27 Crime|Comedy|Action|Adventure 4.503789 7.6 130 7.451997e+07 3.714978e+08 2015
28 Drama|Thriller|History 4.062293 7.8 128 1.839999e+07 8.127872e+07 2015
29 Action|Science Fiction|Thriller 3.968891 6.4 132 5.611998e+07 2.863562e+08 2015
... ... ... ... ... ... ... ...
10836 Comedy|Romance 0.239435 5.8 114 0.000000e+00 0.000000e+00 1966
10837 War|Action|Adventure|Drama 0.291704 5.5 156 0.000000e+00 0.000000e+00 1966
10838 Action|Adventure|Western 0.151845 6.0 117 0.000000e+00 0.000000e+00 1966
10839 Family|Animation 0.276133 7.2 25 0.000000e+00 0.000000e+00 1966
10840 Thriller 0.102530 5.7 102 0.000000e+00 0.000000e+00 1966
10841 Western 0.264925 5.5 82 5.038511e+05 0.000000e+00 1966
10842 Animation|Family 0.253437 7.9 25 0.000000e+00 0.000000e+00 1966
10843 Adventure|Drama|War|History|Action 0.252399 5.8 134 0.000000e+00 0.000000e+00 1966
10844 Adventure|Comedy|Fantasy|Science Fiction 0.236098 5.6 108 0.000000e+00 0.000000e+00 1966
10845 Comedy|Western 0.230873 5.9 93 0.000000e+00 0.000000e+00 1966
10846 Horror 0.212716 5.7 90 0.000000e+00 0.000000e+00 1966
10847 Science Fiction|Horror 0.034555 5.3 89 0.000000e+00 0.000000e+00 1966
10848 Adventure|Science Fiction 0.207257 6.7 100 3.436265e+07 8.061618e+07 1966
10849 Action|Comedy|Crime 0.206537 6.1 109 0.000000e+00 0.000000e+00 1966
10850 Action|Drama|Thriller|Crime|Mystery 0.202473 6.0 121 0.000000e+00 0.000000e+00 1966
10851 Adventure|Drama|Action|Family|Foreign 0.342791 6.6 95 0.000000e+00 0.000000e+00 1966
10852 Western 0.227220 6.0 95 0.000000e+00 0.000000e+00 1966
10853 Comedy|Drama|Romance 0.163592 6.2 114 0.000000e+00 0.000000e+00 1966
10854 Thriller|Drama|Crime 0.146402 6.0 135 0.000000e+00 0.000000e+00 1966
10855 Comedy|Family|Mystery|Romance 0.141026 6.1 90 4.702610e+06 0.000000e+00 1966
10856 Comedy|Drama|Family 0.140934 5.7 93 0.000000e+00 0.000000e+00 1966
10857 Action|Western 0.131378 5.9 128 0.000000e+00 0.000000e+00 1966
10858 Comedy|War 0.317824 5.5 126 0.000000e+00 0.000000e+00 1966
10859 Mystery|Science Fiction|Thriller|Drama 0.089072 6.6 100 0.000000e+00 0.000000e+00 1966
10860 Comedy 0.087034 7.0 87 0.000000e+00 0.000000e+00 1966
10861 Documentary 0.080598 7.4 95 0.000000e+00 0.000000e+00 1966
10862 Action|Adventure|Drama 0.065543 5.7 176 0.000000e+00 0.000000e+00 1966
10863 Mystery|Comedy 0.065141 6.5 94 0.000000e+00 0.000000e+00 1966
10864 Action|Comedy 0.064317 5.4 80 0.000000e+00 0.000000e+00 1966
10865 Horror 0.035919 1.5 74 1.276423e+05 0.000000e+00 1966

10866 rows × 7 columns

In [7]:
# View missing value count for each feature.
df.isnull().sum()
# There is no missing data, so we don't need to drop any rows.
Out[7]:
genres          23
popularity       0
vote_average     0
runtime          0
budget_adj       0
revenue_adj      0
release_year     0
dtype: int64
In [8]:
# Show how many duplicate entries are in the dataset.
sum(df.duplicated())
# There aren't any duplicates, so we don't need to drop any.
Out[8]:
1
In [9]:
# Remove duplicates.
df.drop_duplicates()
sum(df.duplicated())
Out[9]:
1
In [10]:
# Remove rows with zero values.
df = df[(df != 0).all(1)]
df
Out[10]:
genres popularity vote_average runtime budget_adj revenue_adj release_year
0 Action|Adventure|Science Fiction|Thriller 32.985763 6.5 124 1.379999e+08 1.392446e+09 2015
1 Action|Adventure|Science Fiction|Thriller 28.419936 7.1 120 1.379999e+08 3.481613e+08 2015
2 Adventure|Science Fiction|Thriller 13.112507 6.3 119 1.012000e+08 2.716190e+08 2015
3 Action|Adventure|Science Fiction|Fantasy 11.173104 7.5 136 1.839999e+08 1.902723e+09 2015
4 Action|Crime|Thriller 9.335014 7.3 137 1.747999e+08 1.385749e+09 2015
5 Western|Drama|Adventure|Thriller 9.110700 7.2 156 1.241999e+08 4.903142e+08 2015
6 Science Fiction|Action|Thriller|Adventure 8.654359 5.8 125 1.425999e+08 4.053551e+08 2015
7 Drama|Adventure|Science Fiction 7.667400 7.6 141 9.935996e+07 5.477497e+08 2015
8 Family|Animation|Adventure|Comedy 7.404165 6.5 91 6.807997e+07 1.064192e+09 2015
9 Comedy|Animation|Family 6.326804 8.0 94 1.609999e+08 7.854116e+08 2015
10 Action|Adventure|Crime 6.200282 6.2 148 2.253999e+08 8.102203e+08 2015
11 Science Fiction|Fantasy|Action|Adventure 6.189369 5.2 124 1.619199e+08 1.692686e+08 2015
12 Drama|Science Fiction 6.118847 7.6 108 1.379999e+07 3.391985e+07 2015
13 Action|Comedy|Science Fiction 5.984995 5.8 105 8.095996e+07 2.241460e+08 2015
14 Action|Adventure|Science Fiction 5.944927 7.4 141 2.575999e+08 1.292632e+09 2015
15 Crime|Drama|Mystery|Western 5.898400 7.4 167 4.047998e+07 1.432992e+08 2015
16 Crime|Action|Thriller 5.749758 6.1 109 4.415998e+07 2.997096e+08 2015
17 Science Fiction|Action|Adventure 5.573184 7.0 115 1.195999e+08 4.771138e+08 2015
18 Romance|Fantasy|Family|Drama 5.556818 6.8 112 8.739996e+07 4.989630e+08 2015
19 War|Adventure|Science Fiction 5.476958 6.5 136 1.471999e+08 5.984813e+08 2015
20 Action|Family|Science Fiction|Adventure|Mystery 5.462138 6.2 130 1.747999e+08 1.923127e+08 2015
21 Action|Drama 5.337064 7.3 123 2.759999e+07 8.437300e+07 2015
22 Action|Drama|Thriller 4.907832 6.1 114 1.012000e+08 4.328514e+08 2015
23 Drama|Romance 4.710402 5.3 125 3.679998e+07 5.240791e+08 2015
24 Comedy|Drama 4.648046 7.3 130 2.575999e+07 1.226787e+08 2015
25 Action 4.566713 7.1 131 1.379999e+08 6.277435e+08 2015
26 Comedy 4.564549 6.3 115 6.255997e+07 1.985944e+08 2015
27 Crime|Comedy|Action|Adventure 4.503789 7.6 130 7.451997e+07 3.714978e+08 2015
28 Drama|Thriller|History 4.062293 7.8 128 1.839999e+07 8.127872e+07 2015
29 Action|Science Fiction|Thriller 3.968891 6.4 132 5.611998e+07 2.863562e+08 2015
... ... ... ... ... ... ... ...
10690 Drama|Family|Music|Romance 1.313676 7.2 174 5.674862e+07 1.129535e+09 1965
10691 Drama|Romance|War 1.282053 6.9 197 9.688789e+07 7.731786e+08 1965
10692 Action|Adventure|Comedy 0.622157 6.6 138 3.875516e+07 2.072709e+08 1965
10716 Drama|History 0.146033 5.7 199 1.384113e+08 8.304676e+07 1965
10724 Adventure|Action|Thriller 1.778746 6.4 142 4.160985e+07 4.872780e+08 1969
10725 History|Drama|Western|Crime 1.357317 7.0 110 3.566559e+07 6.081511e+08 1969
10727 Drama 0.859806 7.0 113 2.139935e+07 2.662142e+08 1969
10728 Adventure|Western 0.615889 7.2 145 3.711650e+07 3.796251e+06 1969
10755 Music 1.697618 7.0 110 2.005620e+07 6.077490e+08 1978
10756 Horror|Thriller 1.562700 5.5 116 6.685401e+07 6.280400e+08 1978
10757 Horror 1.210531 7.2 127 2.172755e+06 1.838485e+08 1978
10758 Adventure|Fantasy|Action|Science Fiction 1.210324 6.7 143 1.838485e+08 1.003539e+09 1978
10759 Horror|Thriller 1.198849 7.3 91 1.002810e+06 2.339890e+08 1978
10760 Comedy 1.157930 6.7 109 9.025292e+06 4.713208e+08 1978
10762 Drama|War 0.959754 7.4 183 5.014051e+07 1.671350e+08 1978
10770 Drama|Crime 0.512719 7.5 121 7.688212e+06 1.169945e+08 1978
10771 Drama|Animation|Adventure 0.496029 6.0 132 1.337080e+07 1.018568e+08 1978
10775 Mystery 0.468871 6.2 140 2.647419e+07 4.867000e+07 1978
10777 Drama|Action 0.439210 6.7 145 3.676971e+01 3.676971e+01 1978
10778 Action|Adventure|War|Thriller 0.435312 6.6 118 1.671350e+07 2.416773e+07 1978
10779 Action|Comedy|Drama 0.411826 6.2 110 4.011241e+07 7.609685e+07 1978
10780 Horror|Thriller|Science Fiction|Mystery 0.409377 6.5 115 1.169945e+07 8.038036e+07 1978
10788 Adventure|Family|Fantasy|Music|Science Fiction 0.277769 6.1 134 8.022482e+07 7.036068e+07 1978
10791 Action|Drama|Horror|Thriller 0.236193 6.1 107 2.273036e+07 8.864292e+07 1978
10793 Adventure|Animation|Drama 0.226002 6.8 88 3.342701e+06 1.241401e+07 1978
10822 Drama 0.670274 7.5 131 5.038511e+07 2.266436e+08 1966
10828 Mystery|Thriller 0.402730 6.3 128 2.015404e+07 8.733419e+07 1966
10829 Action|Western 0.395668 6.9 120 3.125892e+07 4.030809e+07 1966
10835 Action|Adventure|Drama|War|Romance 0.299911 7.0 182 8.061618e+07 1.343603e+08 1966
10848 Adventure|Science Fiction 0.207257 6.7 100 3.436265e+07 8.061618e+07 1966

3855 rows × 7 columns

In [11]:
# There are multiple genre entries for each movie. Split these genre entries.
all_genres = df.join(df.genres
               .str.strip('|')
               .str.split('|',expand=True)
               .stack()
               .reset_index(level=1,drop=True)
               .rename('genre')).reset_index(drop=True)
all_genres
Out[11]:
genres popularity vote_average runtime budget_adj revenue_adj release_year genre
0 Action|Adventure|Science Fiction|Thriller 32.985763 6.5 124 1.379999e+08 1.392446e+09 2015 Action
1 Action|Adventure|Science Fiction|Thriller 32.985763 6.5 124 1.379999e+08 1.392446e+09 2015 Adventure
2 Action|Adventure|Science Fiction|Thriller 32.985763 6.5 124 1.379999e+08 1.392446e+09 2015 Science Fiction
3 Action|Adventure|Science Fiction|Thriller 32.985763 6.5 124 1.379999e+08 1.392446e+09 2015 Thriller
4 Action|Adventure|Science Fiction|Thriller 28.419936 7.1 120 1.379999e+08 3.481613e+08 2015 Action
5 Action|Adventure|Science Fiction|Thriller 28.419936 7.1 120 1.379999e+08 3.481613e+08 2015 Adventure
6 Action|Adventure|Science Fiction|Thriller 28.419936 7.1 120 1.379999e+08 3.481613e+08 2015 Science Fiction
7 Action|Adventure|Science Fiction|Thriller 28.419936 7.1 120 1.379999e+08 3.481613e+08 2015 Thriller
8 Adventure|Science Fiction|Thriller 13.112507 6.3 119 1.012000e+08 2.716190e+08 2015 Adventure
9 Adventure|Science Fiction|Thriller 13.112507 6.3 119 1.012000e+08 2.716190e+08 2015 Science Fiction
10 Adventure|Science Fiction|Thriller 13.112507 6.3 119 1.012000e+08 2.716190e+08 2015 Thriller
11 Action|Adventure|Science Fiction|Fantasy 11.173104 7.5 136 1.839999e+08 1.902723e+09 2015 Action
12 Action|Adventure|Science Fiction|Fantasy 11.173104 7.5 136 1.839999e+08 1.902723e+09 2015 Adventure
13 Action|Adventure|Science Fiction|Fantasy 11.173104 7.5 136 1.839999e+08 1.902723e+09 2015 Science Fiction
14 Action|Adventure|Science Fiction|Fantasy 11.173104 7.5 136 1.839999e+08 1.902723e+09 2015 Fantasy
15 Action|Crime|Thriller 9.335014 7.3 137 1.747999e+08 1.385749e+09 2015 Action
16 Action|Crime|Thriller 9.335014 7.3 137 1.747999e+08 1.385749e+09 2015 Crime
17 Action|Crime|Thriller 9.335014 7.3 137 1.747999e+08 1.385749e+09 2015 Thriller
18 Western|Drama|Adventure|Thriller 9.110700 7.2 156 1.241999e+08 4.903142e+08 2015 Western
19 Western|Drama|Adventure|Thriller 9.110700 7.2 156 1.241999e+08 4.903142e+08 2015 Drama
20 Western|Drama|Adventure|Thriller 9.110700 7.2 156 1.241999e+08 4.903142e+08 2015 Adventure
21 Western|Drama|Adventure|Thriller 9.110700 7.2 156 1.241999e+08 4.903142e+08 2015 Thriller
22 Science Fiction|Action|Thriller|Adventure 8.654359 5.8 125 1.425999e+08 4.053551e+08 2015 Science Fiction
23 Science Fiction|Action|Thriller|Adventure 8.654359 5.8 125 1.425999e+08 4.053551e+08 2015 Action
24 Science Fiction|Action|Thriller|Adventure 8.654359 5.8 125 1.425999e+08 4.053551e+08 2015 Thriller
25 Science Fiction|Action|Thriller|Adventure 8.654359 5.8 125 1.425999e+08 4.053551e+08 2015 Adventure
26 Drama|Adventure|Science Fiction 7.667400 7.6 141 9.935996e+07 5.477497e+08 2015 Drama
27 Drama|Adventure|Science Fiction 7.667400 7.6 141 9.935996e+07 5.477497e+08 2015 Adventure
28 Drama|Adventure|Science Fiction 7.667400 7.6 141 9.935996e+07 5.477497e+08 2015 Science Fiction
29 Family|Animation|Adventure|Comedy 7.404165 6.5 91 6.807997e+07 1.064192e+09 2015 Family
... ... ... ... ... ... ... ... ...
10278 Action|Comedy|Drama 0.411826 6.2 110 4.011241e+07 7.609685e+07 1978 Comedy
10279 Action|Comedy|Drama 0.411826 6.2 110 4.011241e+07 7.609685e+07 1978 Drama
10280 Horror|Thriller|Science Fiction|Mystery 0.409377 6.5 115 1.169945e+07 8.038036e+07 1978 Horror
10281 Horror|Thriller|Science Fiction|Mystery 0.409377 6.5 115 1.169945e+07 8.038036e+07 1978 Thriller
10282 Horror|Thriller|Science Fiction|Mystery 0.409377 6.5 115 1.169945e+07 8.038036e+07 1978 Science Fiction
10283 Horror|Thriller|Science Fiction|Mystery 0.409377 6.5 115 1.169945e+07 8.038036e+07 1978 Mystery
10284 Adventure|Family|Fantasy|Music|Science Fiction 0.277769 6.1 134 8.022482e+07 7.036068e+07 1978 Adventure
10285 Adventure|Family|Fantasy|Music|Science Fiction 0.277769 6.1 134 8.022482e+07 7.036068e+07 1978 Family
10286 Adventure|Family|Fantasy|Music|Science Fiction 0.277769 6.1 134 8.022482e+07 7.036068e+07 1978 Fantasy
10287 Adventure|Family|Fantasy|Music|Science Fiction 0.277769 6.1 134 8.022482e+07 7.036068e+07 1978 Music
10288 Adventure|Family|Fantasy|Music|Science Fiction 0.277769 6.1 134 8.022482e+07 7.036068e+07 1978 Science Fiction
10289 Action|Drama|Horror|Thriller 0.236193 6.1 107 2.273036e+07 8.864292e+07 1978 Action
10290 Action|Drama|Horror|Thriller 0.236193 6.1 107 2.273036e+07 8.864292e+07 1978 Drama
10291 Action|Drama|Horror|Thriller 0.236193 6.1 107 2.273036e+07 8.864292e+07 1978 Horror
10292 Action|Drama|Horror|Thriller 0.236193 6.1 107 2.273036e+07 8.864292e+07 1978 Thriller
10293 Adventure|Animation|Drama 0.226002 6.8 88 3.342701e+06 1.241401e+07 1978 Adventure
10294 Adventure|Animation|Drama 0.226002 6.8 88 3.342701e+06 1.241401e+07 1978 Animation
10295 Adventure|Animation|Drama 0.226002 6.8 88 3.342701e+06 1.241401e+07 1978 Drama
10296 Drama 0.670274 7.5 131 5.038511e+07 2.266436e+08 1966 Drama
10297 Mystery|Thriller 0.402730 6.3 128 2.015404e+07 8.733419e+07 1966 Mystery
10298 Mystery|Thriller 0.402730 6.3 128 2.015404e+07 8.733419e+07 1966 Thriller
10299 Action|Western 0.395668 6.9 120 3.125892e+07 4.030809e+07 1966 Action
10300 Action|Western 0.395668 6.9 120 3.125892e+07 4.030809e+07 1966 Western
10301 Action|Adventure|Drama|War|Romance 0.299911 7.0 182 8.061618e+07 1.343603e+08 1966 Action
10302 Action|Adventure|Drama|War|Romance 0.299911 7.0 182 8.061618e+07 1.343603e+08 1966 Adventure
10303 Action|Adventure|Drama|War|Romance 0.299911 7.0 182 8.061618e+07 1.343603e+08 1966 Drama
10304 Action|Adventure|Drama|War|Romance 0.299911 7.0 182 8.061618e+07 1.343603e+08 1966 War
10305 Action|Adventure|Drama|War|Romance 0.299911 7.0 182 8.061618e+07 1.343603e+08 1966 Romance
10306 Adventure|Science Fiction 0.207257 6.7 100 3.436265e+07 8.061618e+07 1966 Adventure
10307 Adventure|Science Fiction 0.207257 6.7 100 3.436265e+07 8.061618e+07 1966 Science Fiction

10308 rows × 8 columns

In [12]:
# Group the mean adjusted budget by genre
genre_budget = all_genres.groupby('genre').budget_adj.mean()

# Group the mean popularity by genre
genre_popularity = all_genres.groupby('genre').popularity.mean()

# Group the mean runtime by genre
genre_runtime = all_genres.groupby('genre').runtime.mean()

# Group the mean release year by genre
genre_release_year = all_genres.groupby('genre').release_year.mean()

# Group the mean vote average by genre
genre_vote = all_genres.groupby('genre').vote_average.mean()

# Group the mean adjusted revenue by genre
genre_revenue = all_genres.groupby('genre').revenue_adj.mean()

# Combine all of the new data into one dataframe
genre_data = pd.concat([genre_budget, genre_popularity, genre_revenue, genre_runtime, genre_release_year, genre_vote], axis=1)  # Combine data frame based on indexes (genre)
genre_data
Out[12]:
budget_adj popularity revenue_adj runtime release_year vote_average
genre
Action 6.640907e+07 1.566222 1.952089e+08 111.645488 2000.690608 6.036004
Adventure 8.125573e+07 1.867693 2.714075e+08 112.615487 2000.178905 6.124433
Animation 8.347215e+07 1.710622 2.909574e+08 89.228856 2003.930348 6.380597
Comedy 3.917646e+07 1.012321 1.213085e+08 101.650957 2001.655376 6.026436
Crime 3.989487e+07 1.123152 1.102273e+08 111.523006 2000.682515 6.298620
Documentary 5.379702e+06 0.294458 2.480617e+07 101.428571 2004.742857 6.660000
Drama 3.470978e+07 1.001181 1.013213e+08 115.892430 2001.393853 6.395959
Family 7.110099e+07 1.459043 2.437910e+08 98.665882 2001.682353 6.127059
Fantasy 8.023752e+07 1.754315 2.499928e+08 107.608586 2001.184343 6.062879
Foreign 1.289824e+07 0.179608 1.273378e+07 123.153846 2001.461538 6.123077
History 5.687985e+07 0.970674 1.216617e+08 142.286822 1998.224806 6.578295
Horror 2.324071e+07 0.854005 8.140656e+07 99.144708 1999.667387 5.710799
Music 3.519802e+07 0.899005 1.345660e+08 109.330882 1998.772059 6.315441
Mystery 4.236264e+07 1.142613 1.136210e+08 112.081395 2000.781977 6.194767
Romance 3.390431e+07 0.954889 1.135198e+08 110.536732 2001.070465 6.189955
Science Fiction 6.554873e+07 1.870838 2.017662e+08 108.217308 1999.961538 6.027308
TV Movie 6.951084e+06 0.273628 5.838910e+07 89.000000 1996.000000 5.600000
Thriller 4.458965e+07 1.258400 1.280653e+08 109.353527 2001.281328 6.065892
War 5.727295e+07 1.246129 1.558981e+08 131.075630 1997.932773 6.586555
Western 6.719107e+07 1.134246 1.356748e+08 126.846154 1993.384615 6.467308

Exploratory Data Analysis

What contributes to making a movie genre popular?

In [13]:
d = genre_data.reset_index()

Part 1: Average Popularity of Genres

In [14]:
# Average popularity of genres
g = sns.barplot(data=d, x="genre", y="popularity")
g.set_xticklabels(g.get_xticklabels(), rotation=90)
ax = plt.gca()
ax.set_title("Average Popularity of Genres")
plt.xlabel("Genre")
plt.ylabel("Popularity")
Out[14]:
Text(0,0.5,'Popularity')

Science fiction was the most popular genre and foreign was the least popular genre.

In [15]:
# List of data to show genre popularity ranking
genre_data.sort_values('popularity', ascending=False).popularity
Out[15]:
genre
Science Fiction    1.870838
Adventure          1.867693
Fantasy            1.754315
Animation          1.710622
Action             1.566222
Family             1.459043
Thriller           1.258400
War                1.246129
Mystery            1.142613
Western            1.134246
Crime              1.123152
Comedy             1.012321
Drama              1.001181
History            0.970674
Romance            0.954889
Music              0.899005
Horror             0.854005
Documentary        0.294458
TV Movie           0.273628
Foreign            0.179608
Name: popularity, dtype: float64
In [16]:
d.popularity.hist(figsize=[8, 5], bins=8)
plt.title('Distribution of Popularity')
plt.xlabel('Popularity')
plt.ylabel('Frequency of Occurence')
Out[16]:
Text(0,0.5,'Frequency of Occurence')

The most frequently occuring popularity score for movie genres is approximately between 0.8 and 1.25.

Part 2: Average Adjusted Budget of Genres vs Average Popularity of Genres

In [17]:
# Average adjusted budget of genres vs average popularity of genres
g = sns.lmplot(data=d, x="budget_adj", y="popularity", hue="genre", fit_reg=False)  # Draw points as separate data without line of fit
sns.regplot(data=d, x="budget_adj", y="popularity", scatter=False, ax=g.axes[0, 0], ci=None)  # Draw line of fit to all points
ax = plt.gca()
ax.set_title("Average Adjusted Budget of Genres vs Average Popularity of Genres")
plt.xlabel("Adjusted Budget")
plt.ylabel("Popularity")
Out[17]:
Text(37.5228,0.5,'Popularity')

There seems to be a positive correlation between the average budget of a genre and the popularity of that genre. In general, the higher the budget, the more popular the genre. On average, animation movies have the highest budget. The most popular genre was science fiction.

In [18]:
d.budget_adj.hist(figsize=[8,5], bins=6)
plt.title('Distribution of Adjusted Budget')
plt.xlabel('Adjusted Budget')
plt.ylabel('Frequency of Occurence')
Out[18]:
Text(0,0.5,'Frequency of Occurence')

The most frequently occuring adjusted budget for movie genres is approximately between 3.1e^7 and 4.4e^7.

Part 3: Average Adjusted Revenue of Genres vs Average Popularity of Genres

In [19]:
# Average adjusted revenue of genres vs average popularity of genres
g = sns.lmplot(data=d, x="revenue_adj", y="popularity", hue="genre", fit_reg=False)  # Draw points as separate data without line of fit
sns.regplot(data=d, x="revenue_adj", y="popularity", scatter=False, ax=g.axes[0, 0], ci=None)  # Draw line of fit to all points
ax = plt.gca()
ax.set_title("Average Adjusted Revenue of Genres vs Average Popularity of Genres")
plt.xlabel("Adjusted Revenue")
plt.ylabel("Popularity")
Out[19]:
Text(37.5228,0.5,'Popularity')

There was also a positive correlation between the average adjusted revenue of a genre and the popularity of that genre. That is to say, the more revenue a genre generates, the more popular the genre is. Animation movies had the highest revenue on average.

In [20]:
d.revenue_adj.hist(figsize=[8, 5], bins=6)
plt.title('Distribution of Revenue')
plt.xlabel('Revenue')
plt.ylabel('Frequency of Occurence')
Out[20]:
Text(0,0.5,'Frequency of Occurence')

The most frequently occuring revenue for movie genres is approximately between 1.1e^8 and 1.5e^7.

Part 4: Average Release Year of Genres vs Average Popularity of Genres

In [21]:
# Average release year of genres vs average popularity of genres
g = sns.lmplot(data=d, x="release_year", y="popularity", hue="genre", fit_reg=False)  # Draw points as separate data without line of fit
ax = plt.gca()
ax.set_title("Average Release Year of Genres vs Average Popularity of Genres")
plt.xlabel("Release Year")
plt.ylabel("Popularity")
Out[21]:
Text(37.5228,0.5,'Popularity')

Overall, there appears to be no correlation between the average release year of a genre and the popularity of the genre. Documentaries were released more recently on average than other movie genres, however they are the third least popular.

In [22]:
d.release_year.hist(figsize=[8, 5], bins=6)
plt.title('Distribution of Release Year')
plt.xlabel('Release Year')
plt.ylabel('Frequency of Occurence')
Out[22]:
Text(0,0.5,'Frequency of Occurence')

The most frequently occuring release year for movie genres is approximately between 2001 and 2003.

Part 5: Average Runtime of Genres vs Average Popularity of Genres

In [23]:
# Average runtime of genres vs average popularity of genres
g = sns.lmplot(data=d, x="runtime", y="popularity", hue="genre", fit_reg=False)  # Draw points as separate data without line of fit
ax = plt.gca()
ax.set_title("Average Runtime of Genres vs Average Popularity of Genres")
plt.xlabel("Runtime")
plt.ylabel("Popularity")
Out[23]:
Text(37.5228,0.5,'Popularity')

There seems to be no correlation between the average runtime and the average popularity of a genre of movie. History movies have the longest runtimes on average.

In [24]:
d.runtime.hist(figsize=[8, 5], bins=6)
plt.title('Distribution of Runtime')
plt.xlabel('Runtime')
plt.ylabel('Frequency of Occurence')
Out[24]:
Text(0,0.5,'Frequency of Occurence')

The most frequently occuring runtime for movie genres is approximately between 107 and 116.

Part 6: Vote Average of Genres vs Average Popularity of Genres

In [25]:
# Vote Average vs Average Popularity of Genres
g = sns.lmplot(data=d, x="vote_average", y="popularity", hue="genre", fit_reg=False)  # Draw points as separate data without line of fit  # Draw line of fit to all points
ax = plt.gca()
ax.set_title("Vote Average of Genres vs Average Popularity of Genres")
plt.xlabel("Vote Average")
plt.ylabel("Popularity")
Out[25]:
Text(37.5228,0.5,'Popularity')

The highest voted movie genres don't seem to be the most popular genres. Documentaries were the third least popular movies, but had the highest average vote (6.7).

In [26]:
d.vote_average.hist(figsize=[8, 5], bins=6)
plt.title('Distribution of Vote Average')
plt.xlabel('Vote Average')
plt.ylabel('Frequency of Occurence')
Out[26]:
Text(0,0.5,'Frequency of Occurence')

The most frequently occuring vote budget for movie genres is approximately between 5.95 and 6.15.

Conclusions

There are many different factors that seem to correlate with the popularity of a genre, but from the limited data we have here, we cannot conclude what exactly causes a genre to be popular.

Factors that seem to contribute to making a genre popular:

  • Budget (positive correlation)
  • Revenue (positive correlation)

Factors that don't seem to contribute to making a genre popular:

  • Runtime (no correlation)
  • Vote average (no correlation)
  • Release year (no correlation)
  1. Science Fiction
  2. Adventure
  3. Fantasy
  4. Animation
  5. Action
  6. Family
  7. Thriller
  8. War
  9. Mystery
  10. Western
  11. Crime
  12. Comedy
  13. Drama
  14. History
  15. Romance
  16. Music
  17. Horror
  18. Documentary
  19. TV Movie
  20. Foreign

Limitations:

  • We don't have data for every movie ever made.
  • Genre of movies may not be accurate.
  • Movies can have multiple genres, so each movie may not be a pure representation of those genres.