In [39]:
import pandas as pd
import numpy as np

tn_df = pd.read_csv('TN_longform.csv')
In [40]:
tn_df
Out[40]:
Unnamed: 0 budget creative_type dom_bo dom_percent_profit genre int_bo int_percent_profit person released role source theatrical_distributor title ww_bo person_count_overall person_role_count
0 0 125000000 Fantasy 317871467 164.810001 Adventure 657176139 123.488464 Chris Columbus 2001 Director Based on Fiction Book/Short Story Warner Bros. Harry Potter and the Sorcerer’s Stone 975047606 15 4
1 1 125000000 Fantasy 317871467 164.810001 Adventure 657176139 123.488464 Steve Kloves 2001 Screenwriter Based on Fiction Book/Short Story Warner Bros. Harry Potter and the Sorcerer’s Stone 975047606 10 8
2 2 125000000 Fantasy 317871467 164.810001 Adventure 657176139 123.488464 J.K. Rowling 2001 Story Creator Based on Fiction Book/Short Story Warner Bros. Harry Potter and the Sorcerer’s Stone 975047606 14 5
3 3 125000000 Fantasy 317871467 164.810001 Adventure 657176139 123.488464 David Heyman 2001 Producer Based on Fiction Book/Short Story Warner Bros. Harry Potter and the Sorcerer’s Stone 975047606 17 16
4 4 125000000 Fantasy 317871467 164.810001 Adventure 657176139 123.488464 Chris Columbus 2001 Executive Producer Based on Fiction Book/Short Story Warner Bros. Harry Potter and the Sorcerer’s Stone 975047606 15 4
5 5 125000000 Fantasy 317871467 164.810001 Adventure 657176139 123.488464 Mark Radcliffe 2001 Executive Producer Based on Fiction Book/Short Story Warner Bros. Harry Potter and the Sorcerer’s Stone 975047606 9 6
6 6 125000000 Fantasy 317871467 164.810001 Adventure 657176139 123.488464 Michael Barnathan 2001 Executive Producer Based on Fiction Book/Short Story Warner Bros. Harry Potter and the Sorcerer’s Stone 975047606 11 6
7 7 125000000 Fantasy 317871467 164.810001 Adventure 657176139 123.488464 Duncan Henderson 2001 Executive Producer Based on Fiction Book/Short Story Warner Bros. Harry Potter and the Sorcerer’s Stone 975047606 6 3
8 8 125000000 Fantasy 317871467 164.810001 Adventure 657176139 123.488464 Tanya Seghatchian 2001 Co-Producer Based on Fiction Book/Short Story Warner Bros. Harry Potter and the Sorcerer’s Stone 975047606 4 2
9 9 125000000 Fantasy 317871467 164.810001 Adventure 657176139 123.488464 John Seale 2001 Cinematographer Based on Fiction Book/Short Story Warner Bros. Harry Potter and the Sorcerer’s Stone 975047606 6 4
10 10 125000000 Fantasy 317871467 164.810001 Adventure 657176139 123.488464 Richard Francis-Bruce 2001 Editor Based on Fiction Book/Short Story Warner Bros. Harry Potter and the Sorcerer’s Stone 975047606 9 9
11 11 125000000 Fantasy 317871467 164.810001 Adventure 657176139 123.488464 John Williams 2001 Composer Based on Fiction Book/Short Story Warner Bros. Harry Potter and the Sorcerer’s Stone 975047606 22 19
12 12 125000000 Fantasy 317871467 164.810001 Adventure 657176139 123.488464 Stuart Craig 2001 Production Designer Based on Fiction Book/Short Story Warner Bros. Harry Potter and the Sorcerer’s Stone 975047606 11 11
13 13 125000000 Fantasy 317871467 164.810001 Adventure 657176139 123.488464 Neil Lamont 2001 Supervising Art Director Based on Fiction Book/Short Story Warner Bros. Harry Potter and the Sorcerer’s Stone 975047606 11 9
14 14 125000000 Fantasy 317871467 164.810001 Adventure 657176139 123.488464 John King 2001 Supervising Art Director Based on Fiction Book/Short Story Warner Bros. Harry Potter and the Sorcerer’s Stone 975047606 8 5
15 15 125000000 Fantasy 317871467 164.810001 Adventure 657176139 123.488464 Michael Lamont 2001 Art Director Based on Fiction Book/Short Story Warner Bros. Harry Potter and the Sorcerer’s Stone 975047606 1 1
16 16 125000000 Fantasy 317871467 164.810001 Adventure 657176139 123.488464 Andrew Ackland-Snow 2001 Art Director Based on Fiction Book/Short Story Warner Bros. Harry Potter and the Sorcerer’s Stone 975047606 9 4
17 17 125000000 Fantasy 317871467 164.810001 Adventure 657176139 123.488464 Steven Lawrence 2001 Art Director Based on Fiction Book/Short Story Warner Bros. Harry Potter and the Sorcerer’s Stone 975047606 7 7
18 18 125000000 Fantasy 317871467 164.810001 Adventure 657176139 123.488464 Lucinda Thomson 2001 Art Director Based on Fiction Book/Short Story Warner Bros. Harry Potter and the Sorcerer’s Stone 975047606 3 3
19 19 125000000 Fantasy 317871467 164.810001 Adventure 657176139 123.488464 Peter Francis 2001 Art Director Based on Fiction Book/Short Story Warner Bros. Harry Potter and the Sorcerer’s Stone 975047606 4 4
20 20 125000000 Fantasy 317871467 164.810001 Adventure 657176139 123.488464 Simon Lamont 2001 Art Director Based on Fiction Book/Short Story Warner Bros. Harry Potter and the Sorcerer’s Stone 975047606 5 1
21 21 125000000 Fantasy 317871467 164.810001 Adventure 657176139 123.488464 Michael Boone 2001 Set Designer Based on Fiction Book/Short Story Warner Bros. Harry Potter and the Sorcerer’s Stone 975047606 1 1
22 22 125000000 Fantasy 317871467 164.810001 Adventure 657176139 123.488464 Peter Dorme 2001 Set Designer Based on Fiction Book/Short Story Warner Bros. Harry Potter and the Sorcerer’s Stone 975047606 4 1
23 23 125000000 Fantasy 317871467 164.810001 Adventure 657176139 123.488464 Toad Tozer 2001 Set Designer Based on Fiction Book/Short Story Warner Bros. Harry Potter and the Sorcerer’s Stone 975047606 1 1
24 24 125000000 Fantasy 317871467 164.810001 Adventure 657176139 123.488464 Rosie Hardwick 2001 Set Designer Based on Fiction Book/Short Story Warner Bros. Harry Potter and the Sorcerer’s Stone 975047606 1 1
25 25 125000000 Fantasy 317871467 164.810001 Adventure 657176139 123.488464 Patricia Johnson 2001 Set Designer Based on Fiction Book/Short Story Warner Bros. Harry Potter and the Sorcerer’s Stone 975047606 1 1
26 26 125000000 Fantasy 317871467 164.810001 Adventure 657176139 123.488464 Stephenie McMillan 2001 Set Decorator Based on Fiction Book/Short Story Warner Bros. Harry Potter and the Sorcerer’s Stone 975047606 6 5
27 27 125000000 Fantasy 317871467 164.810001 Adventure 657176139 123.488464 Judianna Makovsky 2001 Costume Designer Based on Fiction Book/Short Story Warner Bros. Harry Potter and the Sorcerer’s Stone 975047606 12 12
28 28 125000000 Fantasy 317871467 164.810001 Adventure 657176139 123.488464 John Midgley 2001 Sound Mixer Based on Fiction Book/Short Story Warner Bros. Harry Potter and the Sorcerer’s Stone 975047606 6 5
29 29 125000000 Fantasy 317871467 164.810001 Adventure 657176139 123.488464 Eddy Joseph 2001 Supervising Sound Editor Based on Fiction Book/Short Story Warner Bros. Harry Potter and the Sorcerer’s Stone 975047606 6 6
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
64581 121163 21000000 Contemporary Fiction 0 -0.000000 Horror 0 -0.000000 Zawe Ashton 2019 supporting Original Screenplay Netflix Velvet Buzzsaw 0 1 1
64582 121164 21000000 Contemporary Fiction 0 -0.000000 Horror 0 -0.000000 Peter Gadiot 2019 supporting Original Screenplay Netflix Velvet Buzzsaw 0 1 1
64583 121165 21000000 Contemporary Fiction 0 -0.000000 Horror 0 -0.000000 Daveed Diggs 2019 supporting Original Screenplay Netflix Velvet Buzzsaw 0 3 1
64584 121166 50000000 Kids Fiction 0 -0.000000 Adventure 0 -0.000000 Michael Madsen 2019 supporting Original Screenplay Entertainment Studios Motion Pictures Arctic Dogs 0 5 4
64585 121167 50000000 Kids Fiction 0 -0.000000 Adventure 0 -0.000000 Laurie Holden 2019 supporting Original Screenplay Entertainment Studios Motion Pictures Arctic Dogs 0 3 3
64586 121168 90000000 Science Fiction 0 -0.000000 Thriller/Suspense 0 -0.000000 Omari Hardwick 2019 supporting Original Screenplay NaN Army of the Dead 0 2 2
64587 121169 90000000 Science Fiction 0 -0.000000 Thriller/Suspense 0 -0.000000 Chris D'Elia 2019 supporting Original Screenplay NaN Army of the Dead 0 1 1
64588 121170 90000000 Science Fiction 0 -0.000000 Thriller/Suspense 0 -0.000000 Garret Dillahunt 2019 supporting Original Screenplay NaN Army of the Dead 0 3 3
64589 121171 90000000 Science Fiction 0 -0.000000 Thriller/Suspense 0 -0.000000 Raul Castillo 2019 supporting Original Screenplay NaN Army of the Dead 0 2 1
64590 121172 90000000 Science Fiction 0 -0.000000 Thriller/Suspense 0 -0.000000 Nora Arnezeder 2019 supporting Original Screenplay NaN Army of the Dead 0 2 2
64591 121173 90000000 Science Fiction 0 -0.000000 Thriller/Suspense 0 -0.000000 Matthias Schweighofer 2019 supporting Original Screenplay NaN Army of the Dead 0 3 3
64592 121174 90000000 Science Fiction 0 -0.000000 Thriller/Suspense 0 -0.000000 Samantha Win 2019 supporting Original Screenplay NaN Army of the Dead 0 1 1
64593 121175 90000000 Science Fiction 0 -0.000000 Thriller/Suspense 0 -0.000000 Richard Cetrone 2019 supporting Original Screenplay NaN Army of the Dead 0 5 5
64594 121176 13000000 NaN 0 -0.000000 Thriller/Suspense 0 -0.000000 Lannick Gautry 2019 supporting NaN NaN Rogue City 0 1 1
64595 121177 13000000 NaN 0 -0.000000 Thriller/Suspense 0 -0.000000 Stanislas Merhar 2019 supporting NaN NaN Rogue City 0 1 1
64596 121178 13000000 NaN 0 -0.000000 Thriller/Suspense 0 -0.000000 David Belle 2019 supporting NaN NaN Rogue City 0 1 1
64597 121179 50000000 Contemporary Fiction 0 -0.000000 Thriller/Suspense 0 -0.000000 Sterling K. Brown 2020 supporting Based on Fiction Book/Short Story Paramount Pictures The Rhythm Section 0 4 2
64598 121180 50000000 Contemporary Fiction 0 -0.000000 Thriller/Suspense 0 -0.000000 Raza Jaffrey 2020 supporting Based on Fiction Book/Short Story Paramount Pictures The Rhythm Section 0 2 2
64599 121181 50000000 Contemporary Fiction 0 -0.000000 Thriller/Suspense 0 -0.000000 Jude Law 2020 supporting Based on Fiction Book/Short Story Paramount Pictures The Rhythm Section 0 15 5
64600 121182 50000000 Contemporary Fiction 0 -0.000000 Thriller/Suspense 0 -0.000000 Richard Brake 2020 supporting Based on Fiction Book/Short Story Paramount Pictures The Rhythm Section 0 3 3
64601 121183 50000000 Contemporary Fiction 0 -0.000000 Thriller/Suspense 0 -0.000000 Max Casella 2020 supporting Based on Fiction Book/Short Story Paramount Pictures The Rhythm Section 0 2 2
64602 121184 50000000 Contemporary Fiction 0 -0.000000 Thriller/Suspense 0 -0.000000 Daniel Mays 2020 supporting Based on Fiction Book/Short Story Paramount Pictures The Rhythm Section 0 3 3
64603 121185 50000000 Contemporary Fiction 0 -0.000000 Thriller/Suspense 0 -0.000000 Tawfeek Barhom 2020 supporting Based on Fiction Book/Short Story Paramount Pictures The Rhythm Section 0 1 1
64604 121186 82000000 Historical Fiction 0 -0.000000 Adventure 0 -0.000000 Dan Stevens 2020 supporting Based on Fiction Book/Short Story 20th Century Fox Call of the Wild 0 3 1
64605 121187 82000000 Historical Fiction 0 -0.000000 Adventure 0 -0.000000 Karen Gillan 2020 supporting Based on Fiction Book/Short Story 20th Century Fox Call of the Wild 0 7 3
64606 121188 82000000 Historical Fiction 0 -0.000000 Adventure 0 -0.000000 Omar Sy 2020 supporting Based on Fiction Book/Short Story 20th Century Fox Call of the Wild 0 4 3
64607 121189 82000000 Historical Fiction 0 -0.000000 Adventure 0 -0.000000 Colin Woodell 2020 supporting Based on Fiction Book/Short Story 20th Century Fox Call of the Wild 0 1 1
64608 121190 82000000 Historical Fiction 0 -0.000000 Adventure 0 -0.000000 Bradley Whitford 2020 supporting Based on Fiction Book/Short Story 20th Century Fox Call of the Wild 0 5 5
64609 121191 82000000 Historical Fiction 0 -0.000000 Adventure 0 -0.000000 Akpe Gift 2020 supporting Based on Fiction Book/Short Story 20th Century Fox Call of the Wild 0 1 1
64610 121192 82000000 Historical Fiction 0 -0.000000 Adventure 0 -0.000000 Cara Gee 2020 supporting Based on Fiction Book/Short Story 20th Century Fox Call of the Wild 0 1 1

64611 rows × 17 columns

In [41]:
tn_df.groupby(['title', 'theatrical_distributor'])['title'].count()
len(tn_df.groupby('title'))
Out[41]:
949
In [42]:
test_df = tn_df.groupby(['title'])['theatrical_distributor','ww_bo']
In [43]:
test_df
Out[43]:
<pandas.core.groupby.generic.DataFrameGroupBy object at 0x1200ac0b8>
In [44]:
test_df = tn_df
In [45]:
tn_df.groupby(['title', 'theatrical_distributor'])['title'].count()
len(tn_df.groupby('title'))
Out[45]:
949
In [46]:
distributors = tn_df.drop_duplicates(subset=['title','theatrical_distributor'])
In [58]:
pd.DataFrame(distributors.groupby(['theatrical_distributor','released'])['title'].count()).sort_values(by="title", ascending=False).reset_index()
Out[58]:
theatrical_distributor released title
0 Warner Bros. 2018 15
1 Universal 2018 14
2 20th Century Fox 2014 13
3 Paramount Pictures 2011 11
4 Warner Bros. 2016 10
5 20th Century Fox 2017 10
6 Walt Disney 2018 10
7 Sony Pictures 2006 10
8 Universal 2017 10
9 Universal 2015 10
10 Universal 2012 10
11 Warner Bros. 2019 10
12 Paramount Pictures 2010 10
13 Sony Pictures 2009 9
14 Warner Bros. 2013 9
15 Warner Bros. 2017 9
16 Walt Disney 2016 9
17 20th Century Fox 2016 9
18 20th Century Fox 2015 9
19 Sony Pictures 2019 9
20 Sony Pictures 2011 9
21 Sony Pictures 2010 9
22 Paramount Pictures 2006 9
23 Sony Pictures 2012 9
24 Warner Bros. 2009 8
25 Sony Pictures 2003 8
26 Walt Disney 2006 8
27 Universal 2013 8
28 Paramount Pictures 2009 8
29 Warner Bros. 2012 8
... ... ... ...
191 Open Road 2014 1
192 Orion Pictures 2019 1
193 Overture Films 2009 1
194 Paramount Pictures 2020 1
195 Pure Flix Entertainment 2019 1
196 Relativity 2011 1
197 Relativity 2013 1
198 Roadside Attractions 2018 1
199 STX Entertainment 2016 1
200 STX Entertainment 2017 1
201 United Artists 2008 1
202 New Line 2000 1
203 Lionsgate 2008 1
204 Neon 2019 1
205 Lionsgate 2009 1
206 Lionsgate 2010 1
207 Walt Disney 2002 1
208 Vertical Entertainment 2019 1
209 Saban Films 2019 1
210 MGM 2003 1
211 MGM 2006 1
212 MGM 2018 1
213 MGM 2019 1
214 Miramax 2000 1
215 Miramax 2001 1
216 Miramax 2006 1
217 Miramax 2007 1
218 Miramax/Dimension 2000 1
219 Miramax/Dimension 2001 1
220 Weinstein/Dimension 2006 1

221 rows × 3 columns

In [59]:
len(distributors)
distributors
Out[59]:
Unnamed: 0 budget creative_type dom_bo dom_percent_profit genre int_bo int_percent_profit person released role source theatrical_distributor title ww_bo person_count_overall person_role_count
0 0 125000000 Fantasy 317871467 164.810001 Adventure 657176139 123.488464 Chris Columbus 2001 Director Based on Fiction Book/Short Story Warner Bros. Harry Potter and the Sorcerer’s Stone 975047606 15 4
45 45 109000000 Fantasy 315544750 152.773067 Adventure 571666235 123.559100 Barrie M. Osborne 2001 Producer Based on Fiction Book/Short Story New Line The Lord of the Rings: The Fellowship… 887210985 6 3
94 94 115000000 Kids Fiction 289423425 165.931511 Adventure 270334294 174.033877 Pete Docter 2001 Director Original Screenplay Walt Disney Monsters, Inc. 559757719 12 3
123 123 50000000 Kids Fiction 267655011 122.972134 Adventure 224157783 128.709598 Andrew Adamson 2001 Director Based on Fiction Book/Short Story Dreamworks SKG Shrek 491812794 14 4
150 150 123000000 Kids Fiction 260044825 189.751656 Adventure 85096578 -224.508959 Ron Howard 2000 Director Based on Fiction Book/Short Story Universal How the Grinch Stole Christmas 345141403 13 6
183 183 85000000 Contemporary Fiction 233632142 157.188169 Drama 193598374 178.270048 Robert Zemeckis 2000 Director Original Screenplay 20th Century Fox Cast Away 427230516 17 6
210 210 90000000 Contemporary Fiction 226164286 166.096627 Action 121261546 387.893631 Brett Ratner 2001 Director Original Screenplay New Line Rush Hour 2 347425832 12 7
225 225 120000000 Contemporary Fiction 215409889 225.773126 Action 334178627 156.027999 John Woo 2000 Director Based on TV Paramount Pictures Mission: Impossible 2 549588516 3 2
287 287 98000000 Fantasy 202007640 194.223847 Adventure 233032755 172.574984 James Jacks 2001 Producer Remake Universal The Mummy Returns 435040395 3 2
319 319 151500000 Dramatization 198539855 422.067319 Action 250700000 252.721774 Michael Bay 2001 Director Based on Real Life Events Walt Disney Pearl Harbor 449239855 19 6
361 361 103000000 Historical Fiction 187683805 221.628923 Action 270000000 161.676647 Ridley Scott 2000 Director Original Screenplay Dreamworks SKG Gladiator 457683805 18 8
395 395 85000000 Contemporary Fiction 183417150 186.367061 Thriller/Suspense 267311379 146.623530 Steven Soderbergh 2001 Director Remake Warner Bros. Ocean's Eleven 450728529 10 7
418 418 65000000 Contemporary Fiction 182805123 155.175869 Romantic Comedy 191300000 151.464766 Nancy Meyers 2000 Director Original Screenplay Paramount Pictures What Women Want 374105123 14 5
456 456 120000000 Dramatization 182618434 291.636859 Drama 146093000 559.893458 Wolfgang Petersen 2000 Director Based on Factual Book/Article Warner Bros. The Perfect Storm 328711434 3 2
489 489 100000000 Science Fiction 180011740 224.981659 Adventure 182200000 221.654501 Tim Burton 2001 Director Remake 20th Century Fox Planet of the Apes 362211740 9 7
519 519 78000000 Dramatization 170708996 184.134230 Drama 146959062 213.110587 Ron Howard 2001 Director Based on Factual Book/Article Universal A Beautiful Mind 317668058 13 6
546 546 55000000 Contemporary Fiction 166225040 149.449297 Comedy 164200000 150.366300 Jay Roach 2000 Director Original Screenplay Universal Meet the Parents 330425040 12 5
574 574 87000000 Contemporary Fiction 165092266 211.406679 Horror 185008014 188.768251 Ridley Scott 2001 Director Based on Fiction Book/Short Story MGM Hannibal 350100280 18 8
600 600 75000000 Super Hero 157299717 191.130326 Action 139572650 216.148245 Bryan Singer 2000 Director Based on Comic/Graphic Novel 20th Century Fox X-Men 296872367 18 7
642 642 19000000 Contemporary Fiction 157019771 113.766144 Comedy 120180229 118.778372 Keenen Ivory Wayans 2000 Director Original Screenplay Miramax/Dimension Scary Movie 277200000 1 1
671 671 90000000 Contemporary Fiction 155464351 237.479405 Thriller/Suspense 133229638 308.190501 Robert Zemeckis 2000 Director Original Screenplay Dreamworks SKG What Lies Beneath 288693989 17 6
697 697 38000000 Contemporary Fiction 144512310 135.676627 Action 62000000 258.333333 Rob Cohen 2001 Director Based on Factual Book/Article Universal The Fast and the Furious 206512310 4 3
720 720 94000000 Contemporary Fiction 131144183 353.067890 Adventure 142186002 295.077400 Simon West 2001 Director Based on Game Paramount Pictures Lara Croft: Tomb Raider 273330185 2 2
761 761 50000000 Dramatization 125548685 166.182489 Drama 132256558 160.785427 Steven Soderbergh 2000 Director Based on Real Life Events Universal Erin Brockovich 257805243 10 7
763 763 90000000 Contemporary Fiction 125305545 354.917464 Action 134430545 302.563349 McG* 2000 Director Based on TV Sony Pictures Charlie's Angels 259736090 3 2
800 800 48000000 Contemporary Fiction 124107476 163.068706 Drama 84192524 232.624075 Steven Soderbergh 2000 Director Based on TV USA Films Traffic 208300000 10 7
801 801 30000000 Contemporary Fiction 115654751 135.024327 Drama 21051932 -235.267904 Boaz Yakin 2000 Director Based on Real Life Events Walt Disney Remember the Titans 136706683 6 1
825 825 110000000 Historical Fiction 113330342 3402.964080 Drama 101969658 -1269.804673 Roland Emmerich 2000 Director Original Screenplay Sony Pictures The Patriot 215300000 20 7
862 862 72000000 Kids Fiction 112950721 275.821080 Adventure 63151000 -713.651260 Steve Carr 2001 Director Remake 20th Century Fox Dr. Dolittle 2 176101721 3 3
864 864 35000000 Kids Fiction 112692062 145.049647 Adventure 85000000 170.000000 Robert Rodriguez 2001 Director Original Screenplay Miramax/Dimension Spy Kids 197692062 30 4
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
35290 66759 25000000 Contemporary Fiction 8547045 -51.948389 Thriller/Suspense 4394550 -21.327125 Steven Knight 2019 Director Original Screenplay Aviron Pictures Serenity 12941595 3 1
35311 66780 30000000 Contemporary Fiction 7743794 -34.793864 Action 20752720 -224.419721 Luc Besson 2019 Director Original Screenplay Lionsgate Anna 28496514 11 2
35321 66790 25000000 Science Fiction 5958315 -31.290902 Thriller/Suspense 3184326 -14.596505 Rupert Wyatt 2019 Director Original Screenplay Focus Features Captive State 9142641 4 2
35339 66808 9000000 Contemporary Fiction 4950029 -122.223813 Drama 730767 -8.837180 Ry Russo-Young 2019 Director Based on Fiction Book/Short Story Warner Bros. The Sun is Also a Star 5680796 1 1
35383 66852 10000000 Dramatization 4295801 -75.309452 Drama 0 -0.000000 Tom Shadyac 2019 Director Based on Real Life Events Bleecker Street Brian Banks 4295801 6 3
35430 66899 30000000 Science Fiction 4046429 -15.591030 Thriller/Suspense 4990998 -19.956806 Jeffrey Nachmanoff 2019 Director Original Screenplay Entertainment Studios Motion Pictures Replicas 9037427 3 1
35471 66940 8000000 Contemporary Fiction 700261 -9.592959 Drama 0 -0.000000 Ben Hernandez Bray* 2019 Director Original Screenplay Briarcliffe Entertainment El Chicano 700261 2 1
35486 66955 1660000 Contemporary Fiction 0 -0.000000 Multiple Genres 80745 -5.112854 Mitzi Peirone 2019 Director Original Screenplay Blue Fox Entertainment Braid 80745 3 1
35505 66974 11800000 Contemporary Fiction 0 -0.000000 Drama 86691643 115.756097 Joon-ho Bong 2019 Director Original Screenplay Neon Gisaengchung 86691643 3 1
35515 66984 40000000 Contemporary Fiction 0 -0.000000 Drama 0 -0.000000 John Crowley 2019 Director Based on Fiction Book/Short Story Warner Bros. The Goldfinch 0 1 1
35563 67032 75000000 Kids Fiction 0 -0.000000 Adventure 7722499 -11.478576 Lino Disalvo 2019 Director Based on Toy STX Entertainment PLAYMOBIL 7722499 4 1
35586 67055 8600000 Contemporary Fiction 0 -0.000000 Comedy 0 -0.000000 Noah Baumbach 2019 Director Original Screenplay Netflix Marriage Story 0 4 1
35594 67063 159000000 Dramatization 0 -0.000000 Drama 0 -0.000000 Martin Scorsese 2019 Director Based on Real Life Events Netflix The Irishman 0 11 7
35595 67064 25000000 Dramatization 0 -0.000000 Drama 0 -0.000000 Howard Klausner 2019 Screenwriter Based on Factual Book/Article NaN Reagan 0 2 2
35599 67068 40000000 Historical Fiction 0 -0.000000 Drama 5222094 -15.015550 Thomas Vinterberg 2019 Director Original Screenplay Saban Films Kursk 5222094 1 1
35618 67087 11000000 Contemporary Fiction 0 -0.000000 Horror 0 -0.000000 Ciaran Foy 2019 Director Original Screenplay NaN Eli 0 1 1
35626 67095 10300000 Contemporary Fiction 0 -0.000000 Action 12478635 572.773090 Byung-woo Kim 2019 Director Original Screenplay CJ Entertainment PMC: deo beong-keo 12478635 2 1
35634 67103 80000000 Dramatization 0 -0.000000 Drama 0 -0.000000 Tom Harper 2019 Director Based on Real Life Events Amazon Studios The Aeronauts 0 5 1
35647 67116 59500000 Dramatization 0 -0.000000 Action 0 -0.000000 Roland Emmerich 2019 Director Based on Real Life Events Lionsgate Midway 0 20 7
35658 67127 55000000 NaN 0 -0.000000 Thriller/Suspense 0 -0.000000 Todd Phillips 2019 Director NaN Warner Bros. Joker 0 21 7
35669 67138 80000000 Science Fiction 0 -0.000000 Thriller/Suspense 0 -0.000000 James Gray 2019 Director Original Screenplay 20th Century Fox Ad Astra 0 3 1
35682 67151 25000000 Dramatization 0 -0.000000 Drama 5408961 -27.609363 P.B. Shemran* 2019 Director Based on Factual Book/Article Vertical Entertainment The Professor and the Madman 5408961 1 1
35692 67161 21000000 Contemporary Fiction 0 -0.000000 Horror 0 -0.000000 Dan Gilroy 2019 Director Original Screenplay Netflix Velvet Buzzsaw 0 6 1
35701 67170 50000000 Kids Fiction 0 -0.000000 Adventure 0 -0.000000 Aaron Woodley 2019 Director Original Screenplay Entertainment Studios Motion Pictures Arctic Dogs 0 2 1
35731 67200 90000000 Science Fiction 0 -0.000000 Thriller/Suspense 0 -0.000000 Zack Snyder 2019 Director Original Screenplay NaN Army of the Dead 0 13 6
35737 67206 13000000 NaN 0 -0.000000 Thriller/Suspense 0 -0.000000 Olivier Marchal 2019 Director NaN NaN Rogue City 0 1 1
35738 67207 50000000 Contemporary Fiction 0 -0.000000 Thriller/Suspense 0 -0.000000 Reed Morano 2020 Director Based on Fiction Book/Short Story Paramount Pictures The Rhythm Section 0 1 1
35748 67217 82000000 Historical Fiction 0 -0.000000 Adventure 0 -0.000000 Chris Sanders 2020 Director Based on Fiction Book/Short Story 20th Century Fox Call of the Wild 0 6 2
36391 68322 11000000 Factual 72778712 117.805486 Comedy 12500000 833.333333 Johnny Knoxville 2006 lead Based on TV Paramount Pictures Jackass: Number Two 85278712 10 3
36626 68771 6500000 Factual 65281781 111.057848 Concert/Performance 5430318 -507.657229 Miley Cyrus 2008 lead Based on Real Life Events Walt Disney Hannah Montana/Miley Cyrus: Best of B… 70712099 4 2

951 rows × 17 columns

In [68]:
def create_distributor_dfs(year_and_studio):
    year, studio = year_and_studio
    studio_db = distributors[(distributors['released'] == year) \
                       & (distributors['theatrical_distributor'] == studio)]
    return(studio_db)
In [130]:
import matplotlib.pyplot as plt
import matplotlib
import statistics
matplotlib.rcParams['pdf.fonttype'] = 42
matplotlib.rcParams['ps.fonttype'] = 42

colors = np.array(['red', 'orange', 'yellow', 'green', 'blue', 'purple', 'pink', 'brown', 'black', 'salmon'])
def make_scatterplot(for_scatterplot):
    studio, studio_name = for_scatterplot
    studio = studio.sort_values(by='budget',ascending=False)
    studio_movies = [attr for attr in studio['title']]
    studio_budget = [attr for attr in studio['budget']]
#     avg_budget = sum(studio_budget)/len(studio_budget)
#     avg_budget = statistics.median(studio_budget)
    avg_budget = np.percentile(studio_budget, 85) 
    studio_percent_profit = [attr for attr in studio['dom_percent_profit']]
#     avg_pp = sum(studio_percent_profit)/len(studio_percent_profit)
#     avg_pp = statistics.median(studio_percent_profit)
    avg_pp = np.percentile(studio_percent_profit, 85)
    studio_genre = [attr for attr in studio['genre']]
    unique_genres = np.unique(studio_genre, return_inverse=True)[1].tolist()
    genres = np.array(unique_genres)

    movies = studio_movies
    x_coords = studio_budget
    y_coords = studio_percent_profit

    f = plt.figure()
    for i,movie in enumerate(movies):
        x = x_coords[i]
        y = y_coords[i]
        plt.scatter(x, y, marker='o', c=colors[genres][i], label=studio_genre[i] if studio_genre[i] not in plt.gca().get_legend_handles_labels()[1] else '')
        if len(movies) < 4:
            plt.text(x+0.5, y+0.5, movie, fontsize=9)
        else:
            if x > avg_budget:
                plt.text(x+0.5, y+0.5, movie, fontsize=9)
            if (y > avg_pp) and (x < avg_budget):
                plt.text(x+0.5, y+0.5, movie, fontsize=9)

    plt.xlabel('Budget (in millions)')
    plt.ylabel('Percent Profit')
    plt.legend(loc = "lower center", ncol=2, title=studio_name + " " + str(year) + " Portfolio", bbox_to_anchor = (.5, -.5))
    plt.show()
    p = plt.show()
    f.savefig(studio_name + "_" + str(year) + ".pdf", bbox_inches='tight')
In [131]:
for year in range(2010,2020):
    studio = create_distributor_dfs([year, "Warner Bros."])
    make_scatterplot([studio, "WarnerBros_TN_"])

 
# universal_2018 = create_distributor_dfs([2018, "Universal"])
# make_scatterplot([universal_2018, "Universal_TN_"])
In [132]:
for year in range(2010,2020):
    studio = create_distributor_dfs([year, "Universal"])
    make_scatterplot([studio, "Universal_TN_"])   
In [95]:
universal_2018 = distributors[(distributors['released'] == 2018) \
                       & (distributors['theatrical_distributor'] == "Universal")]
In [66]:
wb_2018
Out[66]:
Unnamed: 0 budget creative_type dom_bo dom_percent_profit genre int_bo int_percent_profit person released role source theatrical_distributor title ww_bo person_count_overall person_role_count
29980 55921 160000000 Super Hero 335061807 191.396292 Action 811832833 124.546171 James Wan 2018 Director Based on Comic/Graphic Novel Warner Bros. Aquaman 1146894640 13 5
30212 56483 36000000 Contemporary Fiction 215288866 120.079328 Drama 218056471 119.774084 Bradley Cooper 2018 Director Remake Warner Bros. A Star is Born 433345337 26 1
30516 57062 30000000 Contemporary Fiction 174532921 120.756517 Romantic Comedy 63566790 189.374051 Jon M. Chu 2018 Director Based on Fiction Book/Short Story Warner Bros. Crazy Rich Asians 238099711 3 3
30659 57323 200000000 Fantasy 159555901 -394.509718 Adventure 492664185 168.337709 David Yates 2018 Director Spin-Off Warner Bros. Fantastic Beasts: The Crimes of Grind… 652220086 9 7
30802 57548 178000000 Science Fiction 145443742 -446.745882 Action 384086973 186.371301 Jon Turteltaub 2018 Director Based on Fiction Book/Short Story Warner Bros. The Meg 529530715 5 3
30885 57631 70000000 Contemporary Fiction 140218711 199.688529 Action 156897265 180.554894 Gary Ross 2018 Director Original Screenplay Warner Bros. Ocean’s 8 297115976 8 3
30945 57736 150000000 Science Fiction 137690172 -1118.538553 Adventure 441599964 151.440336 Steven Spielberg 2018 Director Based on Fiction Book/Short Story Warner Bros. Ready Player One 579290136 39 12
31169 58246 50000000 Dramatization 103804407 192.929191 Drama 60422042 579.752432 Clint Eastwood 2018 Director Based on Factual Book/Article Warner Bros. The Mule 164226449 20 7
31292 58441 120000000 Science Fiction 101028233 -532.518837 Action 327028047 157.963161 Brad Peyton 2018 Director Based on Game Warner Bros. Rampage 428056280 4 3
31480 58940 80000000 Kids Fiction 83240103 2569.057311 Adventure 130446466 258.583953 Karey Kirkpatrick 2018 Director Based on Fiction Book/Short Story Warner Bros. Smallfoot 213686569 12 2
31637 59356 37000000 Contemporary Fiction 69179066 214.981585 Comedy 48199018 430.386111 John Francis Daley 2018 Director Original Screenplay Warner Bros. Game Night 117378084 5 1
32018 59842 90000000 Contemporary Fiction 58250803 -183.471736 Action 215226698 171.869658 Roar Uthaug 2018 Director Based on Game Warner Bros. Tomb Raider 273477501 1 1
32190 60014 28000000 Contemporary Fiction 54730625 204.748767 Comedy 22294319 -390.738967 Jeff Tomsic 2018 Director Based on Factual Book/Article Warner Bros. Tag 77024944 1 1
33379 63541 30000000 Contemporary Fiction 53059911 230.095905 Comedy 12700000 -73.410405 Ben Falcone 2018 Director Original Screenplay Warner Bros. Life of the Party 65759911 15 3
33807 63969 35000000 Historical Fiction 45819713 423.483627 Drama 25298665 -260.775089 Nicolai Fuglsig 2018 Director Based on Fiction Book/Short Story Warner Bros. 12 Strong 71118378 1 1
In [ ]: