From 1c166f7270159143c2dff01d6200417f6cac2d84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CAna?= Date: Sat, 28 Oct 2023 14:28:10 +0200 Subject: [PATCH 1/2] workshop started --- .DS_Store | Bin 0 -> 6148 bytes notebooks/your_code_here.ipynb | 1540 +++++++++++++++++++++++++++++++- 2 files changed, 1514 insertions(+), 26 deletions(-) create mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5b42953ba13fa4169c4c496af80b7fafbb5dfaba GIT binary patch literal 6148 zcmeHK%}T>S5Z-O8O(;SR3OxqA7EHAW;w8lT0!H+pQWFw1G-gYannNk%tS{t~_&m<+ zZp6|Goz7Z$RD=+H3nyuk7moAJ8_m|%cH3wh9plb_6s2DT#Vq%N z=?(TSg-FBN4#KM>E=ShxnaGMD$>OOjNTL{0Zm*Lp5~U|*S(M9KUj+=)Fh^E*KJPn& zo;~P0i=I6{Ids52I$kVHV{iZ9^kOtlpEB{H=;ZL_N!ig@!z&nTX7=n)vs7dc5Unfg z3PNIl7$62Vg#o?)8J$g;FwK(~AO?QS0PYVqD59&eQYg0$Xz=$D<1IuKu<M2fr=T8Fv*@OAHVL%M3JC z*TVDv{QLX=auM~20b<}^F~D0xf9S!K^x3*HIXr7^(0fo6%&QcBmVhCTV#vj#xC<%; Z{5BeZuEt6sctGe!K+-@BG4QJld;kk1O^E;i literal 0 HcmV?d00001 diff --git a/notebooks/your_code_here.ipynb b/notebooks/your_code_here.ipynb index f60a09e..9b1df82 100644 --- a/notebooks/your_code_here.ipynb +++ b/notebooks/your_code_here.ipynb @@ -15,43 +15,1531 @@ "execution_count": 1, "id": "ace6da70", "metadata": {}, + "outputs": [], + "source": [ + "import pandas as pd\n", + "import numpy as np" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "d3c3dd76", + "metadata": {}, + "outputs": [], + "source": [ + "Movie_Data = pd.read_csv(\"../data/input/IMDB-Movie-Data.csv\")" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "id": "ae4d8f12", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
RankTitleGenreDescriptionDirectorActorsYearRuntime (Minutes)RatingVotesRevenue (Millions)Metascore
01Guardians of the GalaxyAction,Adventure,Sci-FiA group of intergalactic criminals are forced ...James GunnChris Pratt, Vin Diesel, Bradley Cooper, Zoe S...20141218.1757074333.1376.0
12PrometheusAdventure,Mystery,Sci-FiFollowing clues to the origin of mankind, a te...Ridley ScottNoomi Rapace, Logan Marshall-Green, Michael Fa...20121247.0485820126.4665.0
23SplitHorror,ThrillerThree girls are kidnapped by a man with a diag...M. Night ShyamalanJames McAvoy, Anya Taylor-Joy, Haley Lu Richar...20161177.3157606138.1262.0
34SingAnimation,Comedy,FamilyIn a city of humanoid animals, a hustling thea...Christophe LourdeletMatthew McConaughey,Reese Witherspoon, Seth Ma...20161087.260545270.3259.0
45Suicide SquadAction,Adventure,FantasyA secret government agency recruits some of th...David AyerWill Smith, Jared Leto, Margot Robbie, Viola D...20161236.2393727325.0240.0
56The Great WallAction,Adventure,FantasyEuropean mercenaries searching for black powde...Yimou ZhangMatt Damon, Tian Jing, Willem Dafoe, Andy Lau20161036.15603645.1342.0
67La La LandComedy,Drama,MusicA jazz pianist falls for an aspiring actress i...Damien ChazelleRyan Gosling, Emma Stone, Rosemarie DeWitt, J....20161288.3258682151.0693.0
78MindhornComedyA has-been actor best known for playing the ti...Sean FoleyEssie Davis, Andrea Riseborough, Julian Barrat...2016896.42490NaN71.0
89The Lost City of ZAction,Adventure,BiographyA true-life drama, centering on British explor...James GrayCharlie Hunnam, Robert Pattinson, Sienna Mille...20161417.171888.0178.0
910PassengersAdventure,Drama,RomanceA spacecraft traveling to a distant colony pla...Morten TyldumJennifer Lawrence, Chris Pratt, Michael Sheen,...20161167.0192177100.0141.0
1011Fantastic Beasts and Where to Find ThemAdventure,Family,FantasyThe adventures of writer Newt Scamander in New...David YatesEddie Redmayne, Katherine Waterston, Alison Su...20161337.5232072234.0266.0
1112Hidden FiguresBiography,Drama,HistoryThe story of a team of female African-American...Theodore MelfiTaraji P. Henson, Octavia Spencer, Janelle Mon...20161277.893103169.2774.0
1213Rogue OneAction,Adventure,Sci-FiThe Rebel Alliance makes a risky move to steal...Gareth EdwardsFelicity Jones, Diego Luna, Alan Tudyk, Donnie...20161337.9323118532.1765.0
1314MoanaAnimation,Adventure,ComedyIn Ancient Polynesia, when a terrible curse in...Ron ClementsAuli'i Cravalho, Dwayne Johnson, Rachel House,...20161077.7118151248.7581.0
1415ColossalAction,Comedy,DramaGloria is an out-of-work party girl forced to ...Nacho VigalondoAnne Hathaway, Jason Sudeikis, Austin Stowell,...20161096.486122.8770.0
1516The Secret Life of PetsAnimation,Adventure,ComedyThe quiet life of a terrier named Max is upend...Chris RenaudLouis C.K., Eric Stonestreet, Kevin Hart, Lake...2016876.6120259368.3161.0
1617Hacksaw RidgeBiography,Drama,HistoryWWII American Army Medic Desmond T. Doss, who ...Mel GibsonAndrew Garfield, Sam Worthington, Luke Bracey,...20161398.221176067.1271.0
1718Jason BourneAction,ThrillerThe CIA's most dangerous former operative is d...Paul GreengrassMatt Damon, Tommy Lee Jones, Alicia Vikander,V...20161236.7150823162.1658.0
1819LionBiography,DramaA five-year-old Indian boy gets lost on the st...Garth DavisDev Patel, Nicole Kidman, Rooney Mara, Sunny P...20161188.110206151.6969.0
1920ArrivalDrama,Mystery,Sci-FiWhen twelve mysterious spacecraft appear aroun...Denis VilleneuveAmy Adams, Jeremy Renner, Forest Whitaker,Mich...20161168.0340798100.5081.0
2021GoldAdventure,Drama,ThrillerKenny Wells, a prospector desperate for a luck...Stephen GaghanMatthew McConaughey, Edgar Ramírez, Bryce Dall...20161206.7190537.2249.0
2122Manchester by the SeaDramaA depressed uncle is asked to take care of his...Kenneth LonerganCasey Affleck, Michelle Williams, Kyle Chandle...20161377.913421347.7096.0
2223Hounds of LoveCrime,Drama,HorrorA cold-blooded predatory couple while cruising...Ben YoungEmma Booth, Ashleigh Cummings, Stephen Curry,S...20161086.71115NaN72.0
2324TrollsAnimation,Adventure,ComedyAfter the Bergens invade Troll Village, Poppy,...Walt DohrnAnna Kendrick, Justin Timberlake,Zooey Deschan...2016926.538552153.6956.0
2425Independence Day: ResurgenceAction,Adventure,Sci-FiTwo decades after the first Independence Day i...Roland EmmerichLiam Hemsworth, Jeff Goldblum, Bill Pullman,Ma...20161205.3127553103.1432.0
2526Paris pieds nusComedyFiona visits Paris for the first time to assis...Dominique AbelFiona Gordon, Dominique Abel,Emmanuelle Riva, ...2016836.8222NaNNaN
2627Bahubali: The BeginningAction,Adventure,DramaIn ancient India, an adventurous and daring ma...S.S. RajamouliPrabhas, Rana Daggubati, Anushka Shetty,Tamann...20151598.3761936.50NaN
2728Dead AwakeHorror,ThrillerA young woman must save herself and her friend...Phillip GuzmanJocelin Donahue, Jesse Bradford, Jesse Borrego...2016994.75230.01NaN
2829Bad MomsComedyWhen three overworked and under-appreciated mo...Jon LucasMila Kunis, Kathryn Hahn, Kristen Bell,Christi...20161006.266540113.0860.0
2930Assassin's CreedAction,Adventure,DramaWhen Callum Lynch explores the memories of his...Justin KurzelMichael Fassbender, Marion Cotillard, Jeremy I...20161155.911281354.6536.0
3031Why Him?ComedyA holiday gathering threatens to go off the ra...John HamburgZoey Deutch, James Franco, Tangie Ambrose,Cedr...20161116.34812360.3139.0
3132Nocturnal AnimalsDrama,ThrillerA wealthy art gallery owner is haunted by her ...Tom FordAmy Adams, Jake Gyllenhaal, Michael Shannon, A...20161167.512603010.6467.0
3233X-Men: ApocalypseAction,Adventure,Sci-FiAfter the re-emergence of the world's first mu...Bryan SingerJames McAvoy, Michael Fassbender, Jennifer Law...20161447.1275510155.3352.0
3334DeadpoolAction,Adventure,ComedyA fast-talking mercenary with a morbid sense o...Tim MillerRyan Reynolds, Morena Baccarin, T.J. Miller, E...20161088.0627797363.0265.0
3435Resident Evil: The Final ChapterAction,Horror,Sci-FiAlice returns to where the nightmare began: Th...Paul W.S. AndersonMilla Jovovich, Iain Glen, Ali Larter, Shawn R...20161075.64616526.8449.0
3536Captain America: Civil WarAction,Adventure,Sci-FiPolitical interference in the Avengers' activi...Anthony RussoChris Evans, Robert Downey Jr.,Scarlett Johans...20161477.9411656408.0875.0
3637InterstellarAdventure,Drama,Sci-FiA team of explorers travel through a wormhole ...Christopher NolanMatthew McConaughey, Anne Hathaway, Jessica Ch...20141698.61047747187.9974.0
3738Doctor StrangeAction,Adventure,FantasyWhile on a journey of physical and spiritual h...Scott DerricksonBenedict Cumberbatch, Chiwetel Ejiofor, Rachel...20161157.6293732232.6072.0
3839The Magnificent SevenAction,Adventure,WesternSeven gunmen in the old west gradually come to...Antoine FuquaDenzel Washington, Chris Pratt, Ethan Hawke,Vi...20161326.912285393.3854.0
39405- 25- 77Comedy,DramaAlienated, hopeful-filmmaker Pat Johnson's epi...Patrick Read JohnsonJohn Francis Daley, Austin Pendleton, Colleen ...20071137.1241NaNNaN
4041Sausage PartyAnimation,Adventure,ComedyA sausage strives to discover the truth about ...Greg TiernanSeth Rogen, Kristen Wiig, Jonah Hill, Alistair...2016896.312069097.6666.0
4142MoonlightDramaA chronicle of the childhood, adolescence and ...Barry JenkinsMahershala Ali, Shariff Earp, Duan Sanderson, ...20161117.513509527.8599.0
4243Don't Fuck in the WoodsHorrorA group of friends are going on a camping trip...Shawn BurkettBrittany Blanton, Ayse Howard, Roman Jossart,N...2016732.7496NaNNaN
4344The FounderBiography,Drama,HistoryThe story of Ray Kroc, a salesman who turned t...John Lee HancockMichael Keaton, Nick Offerman, John Carroll Ly...20161157.23703312.7966.0
4445LowridersDramaA young street artist in East Los Angeles is c...Ricardo de MontreuilGabriel Chavarria, Demián Bichir, Theo Rossi,T...2016996.32794.2157.0
4546Pirates of the Caribbean: On Stranger TidesAction,Adventure,FantasyJack Sparrow and Barbossa embark on a quest to...Rob MarshallJohnny Depp, Penélope Cruz, Ian McShane, Geoff...20111366.7395025241.0645.0
4647Miss SloaneDrama,ThrillerIn the high-stakes world of political power-br...John MaddenJessica Chastain, Mark Strong, Gugu Mbatha-Raw...20161327.3178183.4464.0
4748FallenAdventure,Drama,FantasyA young girl finds herself in a reform school ...Scott HicksHermione Corfield, Addison Timlin, Joely Richa...2016915.65103NaNNaN
4849Star Trek BeyondAction,Adventure,Sci-FiThe USS Enterprise crew explores the furthest ...Justin LinChris Pine, Zachary Quinto, Karl Urban, Zoe Sa...20161227.1164567158.8068.0
4950The Last FaceDramaA director (Charlize Theron) of an internation...Sean PennCharlize Theron, Javier Bardem, Adèle Exarchop...20161303.7987NaN16.0
\n", + "
" + ], + "text/plain": [ + " Rank Title \\\n", + "0 1 Guardians of the Galaxy \n", + "1 2 Prometheus \n", + "2 3 Split \n", + "3 4 Sing \n", + "4 5 Suicide Squad \n", + "5 6 The Great Wall \n", + "6 7 La La Land \n", + "7 8 Mindhorn \n", + "8 9 The Lost City of Z \n", + "9 10 Passengers \n", + "10 11 Fantastic Beasts and Where to Find Them \n", + "11 12 Hidden Figures \n", + "12 13 Rogue One \n", + "13 14 Moana \n", + "14 15 Colossal \n", + "15 16 The Secret Life of Pets \n", + "16 17 Hacksaw Ridge \n", + "17 18 Jason Bourne \n", + "18 19 Lion \n", + "19 20 Arrival \n", + "20 21 Gold \n", + "21 22 Manchester by the Sea \n", + "22 23 Hounds of Love \n", + "23 24 Trolls \n", + "24 25 Independence Day: Resurgence \n", + "25 26 Paris pieds nus \n", + "26 27 Bahubali: The Beginning \n", + "27 28 Dead Awake \n", + "28 29 Bad Moms \n", + "29 30 Assassin's Creed \n", + "30 31 Why Him? \n", + "31 32 Nocturnal Animals \n", + "32 33 X-Men: Apocalypse \n", + "33 34 Deadpool \n", + "34 35 Resident Evil: The Final Chapter \n", + "35 36 Captain America: Civil War \n", + "36 37 Interstellar \n", + "37 38 Doctor Strange \n", + "38 39 The Magnificent Seven \n", + "39 40 5- 25- 77 \n", + "40 41 Sausage Party \n", + "41 42 Moonlight \n", + "42 43 Don't Fuck in the Woods \n", + "43 44 The Founder \n", + "44 45 Lowriders \n", + "45 46 Pirates of the Caribbean: On Stranger Tides \n", + "46 47 Miss Sloane \n", + "47 48 Fallen \n", + "48 49 Star Trek Beyond \n", + "49 50 The Last Face \n", + "\n", + " Genre \\\n", + "0 Action,Adventure,Sci-Fi \n", + "1 Adventure,Mystery,Sci-Fi \n", + "2 Horror,Thriller \n", + "3 Animation,Comedy,Family \n", + "4 Action,Adventure,Fantasy \n", + "5 Action,Adventure,Fantasy \n", + "6 Comedy,Drama,Music \n", + "7 Comedy \n", + "8 Action,Adventure,Biography \n", + "9 Adventure,Drama,Romance \n", + "10 Adventure,Family,Fantasy \n", + "11 Biography,Drama,History \n", + "12 Action,Adventure,Sci-Fi \n", + "13 Animation,Adventure,Comedy \n", + "14 Action,Comedy,Drama \n", + "15 Animation,Adventure,Comedy \n", + "16 Biography,Drama,History \n", + "17 Action,Thriller \n", + "18 Biography,Drama \n", + "19 Drama,Mystery,Sci-Fi \n", + "20 Adventure,Drama,Thriller \n", + "21 Drama \n", + "22 Crime,Drama,Horror \n", + "23 Animation,Adventure,Comedy \n", + "24 Action,Adventure,Sci-Fi \n", + "25 Comedy \n", + "26 Action,Adventure,Drama \n", + "27 Horror,Thriller \n", + "28 Comedy \n", + "29 Action,Adventure,Drama \n", + "30 Comedy \n", + "31 Drama,Thriller \n", + "32 Action,Adventure,Sci-Fi \n", + "33 Action,Adventure,Comedy \n", + "34 Action,Horror,Sci-Fi \n", + "35 Action,Adventure,Sci-Fi \n", + "36 Adventure,Drama,Sci-Fi \n", + "37 Action,Adventure,Fantasy \n", + "38 Action,Adventure,Western \n", + "39 Comedy,Drama \n", + "40 Animation,Adventure,Comedy \n", + "41 Drama \n", + "42 Horror \n", + "43 Biography,Drama,History \n", + "44 Drama \n", + "45 Action,Adventure,Fantasy \n", + "46 Drama,Thriller \n", + "47 Adventure,Drama,Fantasy \n", + "48 Action,Adventure,Sci-Fi \n", + "49 Drama \n", + "\n", + " Description Director \\\n", + "0 A group of intergalactic criminals are forced ... James Gunn \n", + "1 Following clues to the origin of mankind, a te... Ridley Scott \n", + "2 Three girls are kidnapped by a man with a diag... M. Night Shyamalan \n", + "3 In a city of humanoid animals, a hustling thea... Christophe Lourdelet \n", + "4 A secret government agency recruits some of th... David Ayer \n", + "5 European mercenaries searching for black powde... Yimou Zhang \n", + "6 A jazz pianist falls for an aspiring actress i... Damien Chazelle \n", + "7 A has-been actor best known for playing the ti... Sean Foley \n", + "8 A true-life drama, centering on British explor... James Gray \n", + "9 A spacecraft traveling to a distant colony pla... Morten Tyldum \n", + "10 The adventures of writer Newt Scamander in New... David Yates \n", + "11 The story of a team of female African-American... Theodore Melfi \n", + "12 The Rebel Alliance makes a risky move to steal... Gareth Edwards \n", + "13 In Ancient Polynesia, when a terrible curse in... Ron Clements \n", + "14 Gloria is an out-of-work party girl forced to ... Nacho Vigalondo \n", + "15 The quiet life of a terrier named Max is upend... Chris Renaud \n", + "16 WWII American Army Medic Desmond T. Doss, who ... Mel Gibson \n", + "17 The CIA's most dangerous former operative is d... Paul Greengrass \n", + "18 A five-year-old Indian boy gets lost on the st... Garth Davis \n", + "19 When twelve mysterious spacecraft appear aroun... Denis Villeneuve \n", + "20 Kenny Wells, a prospector desperate for a luck... Stephen Gaghan \n", + "21 A depressed uncle is asked to take care of his... Kenneth Lonergan \n", + "22 A cold-blooded predatory couple while cruising... Ben Young \n", + "23 After the Bergens invade Troll Village, Poppy,... Walt Dohrn \n", + "24 Two decades after the first Independence Day i... Roland Emmerich \n", + "25 Fiona visits Paris for the first time to assis... Dominique Abel \n", + "26 In ancient India, an adventurous and daring ma... S.S. Rajamouli \n", + "27 A young woman must save herself and her friend... Phillip Guzman \n", + "28 When three overworked and under-appreciated mo... Jon Lucas \n", + "29 When Callum Lynch explores the memories of his... Justin Kurzel \n", + "30 A holiday gathering threatens to go off the ra... John Hamburg \n", + "31 A wealthy art gallery owner is haunted by her ... Tom Ford \n", + "32 After the re-emergence of the world's first mu... Bryan Singer \n", + "33 A fast-talking mercenary with a morbid sense o... Tim Miller \n", + "34 Alice returns to where the nightmare began: Th... Paul W.S. Anderson \n", + "35 Political interference in the Avengers' activi... Anthony Russo \n", + "36 A team of explorers travel through a wormhole ... Christopher Nolan \n", + "37 While on a journey of physical and spiritual h... Scott Derrickson \n", + "38 Seven gunmen in the old west gradually come to... Antoine Fuqua \n", + "39 Alienated, hopeful-filmmaker Pat Johnson's epi... Patrick Read Johnson \n", + "40 A sausage strives to discover the truth about ... Greg Tiernan \n", + "41 A chronicle of the childhood, adolescence and ... Barry Jenkins \n", + "42 A group of friends are going on a camping trip... Shawn Burkett \n", + "43 The story of Ray Kroc, a salesman who turned t... John Lee Hancock \n", + "44 A young street artist in East Los Angeles is c... Ricardo de Montreuil \n", + "45 Jack Sparrow and Barbossa embark on a quest to... Rob Marshall \n", + "46 In the high-stakes world of political power-br... John Madden \n", + "47 A young girl finds herself in a reform school ... Scott Hicks \n", + "48 The USS Enterprise crew explores the furthest ... Justin Lin \n", + "49 A director (Charlize Theron) of an internation... Sean Penn \n", + "\n", + " Actors Year \\\n", + "0 Chris Pratt, Vin Diesel, Bradley Cooper, Zoe S... 2014 \n", + "1 Noomi Rapace, Logan Marshall-Green, Michael Fa... 2012 \n", + "2 James McAvoy, Anya Taylor-Joy, Haley Lu Richar... 2016 \n", + "3 Matthew McConaughey,Reese Witherspoon, Seth Ma... 2016 \n", + "4 Will Smith, Jared Leto, Margot Robbie, Viola D... 2016 \n", + "5 Matt Damon, Tian Jing, Willem Dafoe, Andy Lau 2016 \n", + "6 Ryan Gosling, Emma Stone, Rosemarie DeWitt, J.... 2016 \n", + "7 Essie Davis, Andrea Riseborough, Julian Barrat... 2016 \n", + "8 Charlie Hunnam, Robert Pattinson, Sienna Mille... 2016 \n", + "9 Jennifer Lawrence, Chris Pratt, Michael Sheen,... 2016 \n", + "10 Eddie Redmayne, Katherine Waterston, Alison Su... 2016 \n", + "11 Taraji P. Henson, Octavia Spencer, Janelle Mon... 2016 \n", + "12 Felicity Jones, Diego Luna, Alan Tudyk, Donnie... 2016 \n", + "13 Auli'i Cravalho, Dwayne Johnson, Rachel House,... 2016 \n", + "14 Anne Hathaway, Jason Sudeikis, Austin Stowell,... 2016 \n", + "15 Louis C.K., Eric Stonestreet, Kevin Hart, Lake... 2016 \n", + "16 Andrew Garfield, Sam Worthington, Luke Bracey,... 2016 \n", + "17 Matt Damon, Tommy Lee Jones, Alicia Vikander,V... 2016 \n", + "18 Dev Patel, Nicole Kidman, Rooney Mara, Sunny P... 2016 \n", + "19 Amy Adams, Jeremy Renner, Forest Whitaker,Mich... 2016 \n", + "20 Matthew McConaughey, Edgar Ramírez, Bryce Dall... 2016 \n", + "21 Casey Affleck, Michelle Williams, Kyle Chandle... 2016 \n", + "22 Emma Booth, Ashleigh Cummings, Stephen Curry,S... 2016 \n", + "23 Anna Kendrick, Justin Timberlake,Zooey Deschan... 2016 \n", + "24 Liam Hemsworth, Jeff Goldblum, Bill Pullman,Ma... 2016 \n", + "25 Fiona Gordon, Dominique Abel,Emmanuelle Riva, ... 2016 \n", + "26 Prabhas, Rana Daggubati, Anushka Shetty,Tamann... 2015 \n", + "27 Jocelin Donahue, Jesse Bradford, Jesse Borrego... 2016 \n", + "28 Mila Kunis, Kathryn Hahn, Kristen Bell,Christi... 2016 \n", + "29 Michael Fassbender, Marion Cotillard, Jeremy I... 2016 \n", + "30 Zoey Deutch, James Franco, Tangie Ambrose,Cedr... 2016 \n", + "31 Amy Adams, Jake Gyllenhaal, Michael Shannon, A... 2016 \n", + "32 James McAvoy, Michael Fassbender, Jennifer Law... 2016 \n", + "33 Ryan Reynolds, Morena Baccarin, T.J. Miller, E... 2016 \n", + "34 Milla Jovovich, Iain Glen, Ali Larter, Shawn R... 2016 \n", + "35 Chris Evans, Robert Downey Jr.,Scarlett Johans... 2016 \n", + "36 Matthew McConaughey, Anne Hathaway, Jessica Ch... 2014 \n", + "37 Benedict Cumberbatch, Chiwetel Ejiofor, Rachel... 2016 \n", + "38 Denzel Washington, Chris Pratt, Ethan Hawke,Vi... 2016 \n", + "39 John Francis Daley, Austin Pendleton, Colleen ... 2007 \n", + "40 Seth Rogen, Kristen Wiig, Jonah Hill, Alistair... 2016 \n", + "41 Mahershala Ali, Shariff Earp, Duan Sanderson, ... 2016 \n", + "42 Brittany Blanton, Ayse Howard, Roman Jossart,N... 2016 \n", + "43 Michael Keaton, Nick Offerman, John Carroll Ly... 2016 \n", + "44 Gabriel Chavarria, Demián Bichir, Theo Rossi,T... 2016 \n", + "45 Johnny Depp, Penélope Cruz, Ian McShane, Geoff... 2011 \n", + "46 Jessica Chastain, Mark Strong, Gugu Mbatha-Raw... 2016 \n", + "47 Hermione Corfield, Addison Timlin, Joely Richa... 2016 \n", + "48 Chris Pine, Zachary Quinto, Karl Urban, Zoe Sa... 2016 \n", + "49 Charlize Theron, Javier Bardem, Adèle Exarchop... 2016 \n", + "\n", + " Runtime (Minutes) Rating Votes Revenue (Millions) Metascore \n", + "0 121 8.1 757074 333.13 76.0 \n", + "1 124 7.0 485820 126.46 65.0 \n", + "2 117 7.3 157606 138.12 62.0 \n", + "3 108 7.2 60545 270.32 59.0 \n", + "4 123 6.2 393727 325.02 40.0 \n", + "5 103 6.1 56036 45.13 42.0 \n", + "6 128 8.3 258682 151.06 93.0 \n", + "7 89 6.4 2490 NaN 71.0 \n", + "8 141 7.1 7188 8.01 78.0 \n", + "9 116 7.0 192177 100.01 41.0 \n", + "10 133 7.5 232072 234.02 66.0 \n", + "11 127 7.8 93103 169.27 74.0 \n", + "12 133 7.9 323118 532.17 65.0 \n", + "13 107 7.7 118151 248.75 81.0 \n", + "14 109 6.4 8612 2.87 70.0 \n", + "15 87 6.6 120259 368.31 61.0 \n", + "16 139 8.2 211760 67.12 71.0 \n", + "17 123 6.7 150823 162.16 58.0 \n", + "18 118 8.1 102061 51.69 69.0 \n", + "19 116 8.0 340798 100.50 81.0 \n", + "20 120 6.7 19053 7.22 49.0 \n", + "21 137 7.9 134213 47.70 96.0 \n", + "22 108 6.7 1115 NaN 72.0 \n", + "23 92 6.5 38552 153.69 56.0 \n", + "24 120 5.3 127553 103.14 32.0 \n", + "25 83 6.8 222 NaN NaN \n", + "26 159 8.3 76193 6.50 NaN \n", + "27 99 4.7 523 0.01 NaN \n", + "28 100 6.2 66540 113.08 60.0 \n", + "29 115 5.9 112813 54.65 36.0 \n", + "30 111 6.3 48123 60.31 39.0 \n", + "31 116 7.5 126030 10.64 67.0 \n", + "32 144 7.1 275510 155.33 52.0 \n", + "33 108 8.0 627797 363.02 65.0 \n", + "34 107 5.6 46165 26.84 49.0 \n", + "35 147 7.9 411656 408.08 75.0 \n", + "36 169 8.6 1047747 187.99 74.0 \n", + "37 115 7.6 293732 232.60 72.0 \n", + "38 132 6.9 122853 93.38 54.0 \n", + "39 113 7.1 241 NaN NaN \n", + "40 89 6.3 120690 97.66 66.0 \n", + "41 111 7.5 135095 27.85 99.0 \n", + "42 73 2.7 496 NaN NaN \n", + "43 115 7.2 37033 12.79 66.0 \n", + "44 99 6.3 279 4.21 57.0 \n", + "45 136 6.7 395025 241.06 45.0 \n", + "46 132 7.3 17818 3.44 64.0 \n", + "47 91 5.6 5103 NaN NaN \n", + "48 122 7.1 164567 158.80 68.0 \n", + "49 130 3.7 987 NaN 16.0 " + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "Movie_Data.head(50)" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "id": "16ff0751", + "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "The Zen of Python, by Tim Peters\n", - "\n", - "Beautiful is better than ugly.\n", - "Explicit is better than implicit.\n", - "Simple is better than complex.\n", - "Complex is better than complicated.\n", - "Flat is better than nested.\n", - "Sparse is better than dense.\n", - "Readability counts.\n", - "Special cases aren't special enough to break the rules.\n", - "Although practicality beats purity.\n", - "Errors should never pass silently.\n", - "Unless explicitly silenced.\n", - "In the face of ambiguity, refuse the temptation to guess.\n", - "There should be one-- and preferably only one --obvious way to do it.\n", - "Although that way may not be obvious at first unless you're Dutch.\n", - "Now is better than never.\n", - "Although never is often better than *right* now.\n", - "If the implementation is hard to explain, it's a bad idea.\n", - "If the implementation is easy to explain, it may be a good idea.\n", - "Namespaces are one honking great idea -- let's do more of those!\n" + "\n", + "RangeIndex: 1000 entries, 0 to 999\n", + "Data columns (total 12 columns):\n", + " # Column Non-Null Count Dtype \n", + "--- ------ -------------- ----- \n", + " 0 Rank 1000 non-null int64 \n", + " 1 Title 1000 non-null object \n", + " 2 Genre 1000 non-null object \n", + " 3 Description 1000 non-null object \n", + " 4 Director 1000 non-null object \n", + " 5 Actors 1000 non-null object \n", + " 6 Year 1000 non-null int64 \n", + " 7 Runtime (Minutes) 1000 non-null int64 \n", + " 8 Rating 1000 non-null float64\n", + " 9 Votes 1000 non-null int64 \n", + " 10 Revenue (Millions) 872 non-null float64\n", + " 11 Metascore 936 non-null float64\n", + "dtypes: float64(3), int64(4), object(5)\n", + "memory usage: 93.9+ KB\n" + ] + } + ], + "source": [ + "Movie_Data.info()" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "id": "a728f7bc", + "metadata": {}, + "outputs": [], + "source": [ + "def warm_up(x):\n", + " if x >= 0 and x <= 999:\n", + " return \"cat_1\"\n", + " elif x >= 1000 and x <= 9999:\n", + " return \"cat_2\"\n", + " elif x >= 10000 and x <= 99999:\n", + " return \"cat_3\"\n", + " elif x >= 100000 and x <= 999999:\n", + " return \"cat_4\"\n", + " else:\n", + " return \"cat_5\"\n" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "id": "6a8634a4", + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
RankTitleGenreDescriptionDirectorActorsYearRuntime (Minutes)RatingVotesRevenue (Millions)Metascorebin
01Guardians of the GalaxyAction,Adventure,Sci-FiA group of intergalactic criminals are forced ...James GunnChris Pratt, Vin Diesel, Bradley Cooper, Zoe S...20141218.1757074333.1376.0cat_4
12PrometheusAdventure,Mystery,Sci-FiFollowing clues to the origin of mankind, a te...Ridley ScottNoomi Rapace, Logan Marshall-Green, Michael Fa...20121247.0485820126.4665.0cat_4
23SplitHorror,ThrillerThree girls are kidnapped by a man with a diag...M. Night ShyamalanJames McAvoy, Anya Taylor-Joy, Haley Lu Richar...20161177.3157606138.1262.0cat_4
34SingAnimation,Comedy,FamilyIn a city of humanoid animals, a hustling thea...Christophe LourdeletMatthew McConaughey,Reese Witherspoon, Seth Ma...20161087.260545270.3259.0cat_3
45Suicide SquadAction,Adventure,FantasyA secret government agency recruits some of th...David AyerWill Smith, Jared Leto, Margot Robbie, Viola D...20161236.2393727325.0240.0cat_4
\n", + "
" + ], + "text/plain": [ + " Rank Title Genre \\\n", + "0 1 Guardians of the Galaxy Action,Adventure,Sci-Fi \n", + "1 2 Prometheus Adventure,Mystery,Sci-Fi \n", + "2 3 Split Horror,Thriller \n", + "3 4 Sing Animation,Comedy,Family \n", + "4 5 Suicide Squad Action,Adventure,Fantasy \n", + "\n", + " Description Director \\\n", + "0 A group of intergalactic criminals are forced ... James Gunn \n", + "1 Following clues to the origin of mankind, a te... Ridley Scott \n", + "2 Three girls are kidnapped by a man with a diag... M. Night Shyamalan \n", + "3 In a city of humanoid animals, a hustling thea... Christophe Lourdelet \n", + "4 A secret government agency recruits some of th... David Ayer \n", + "\n", + " Actors Year Runtime (Minutes) \\\n", + "0 Chris Pratt, Vin Diesel, Bradley Cooper, Zoe S... 2014 121 \n", + "1 Noomi Rapace, Logan Marshall-Green, Michael Fa... 2012 124 \n", + "2 James McAvoy, Anya Taylor-Joy, Haley Lu Richar... 2016 117 \n", + "3 Matthew McConaughey,Reese Witherspoon, Seth Ma... 2016 108 \n", + "4 Will Smith, Jared Leto, Margot Robbie, Viola D... 2016 123 \n", + "\n", + " Rating Votes Revenue (Millions) Metascore bin \n", + "0 8.1 757074 333.13 76.0 cat_4 \n", + "1 7.0 485820 126.46 65.0 cat_4 \n", + "2 7.3 157606 138.12 62.0 cat_4 \n", + "3 7.2 60545 270.32 59.0 cat_3 \n", + "4 6.2 393727 325.02 40.0 cat_4 " + ] + }, + "execution_count": 20, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "Movie_Data[\"bin\"]= Movie_Data.apply(lambda row:warm_up(row[\"Votes\"]), axis = 1)\n", + "Movie_Data.head()" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "id": "f43e9248", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
RankTitleGenreDescriptionDirectorActorsYearRuntime (Minutes)RatingVotesRevenue (Millions)MetascorebinRevenue per minute
01Guardians of the GalaxyAction,Adventure,Sci-FiA group of intergalactic criminals are forced ...James GunnChris Pratt, Vin Diesel, Bradley Cooper, Zoe S...20141218.1757074333.1376.0cat_42.75
12PrometheusAdventure,Mystery,Sci-FiFollowing clues to the origin of mankind, a te...Ridley ScottNoomi Rapace, Logan Marshall-Green, Michael Fa...20121247.0485820126.4665.0cat_41.02
23SplitHorror,ThrillerThree girls are kidnapped by a man with a diag...M. Night ShyamalanJames McAvoy, Anya Taylor-Joy, Haley Lu Richar...20161177.3157606138.1262.0cat_41.18
34SingAnimation,Comedy,FamilyIn a city of humanoid animals, a hustling thea...Christophe LourdeletMatthew McConaughey,Reese Witherspoon, Seth Ma...20161087.260545270.3259.0cat_32.50
45Suicide SquadAction,Adventure,FantasyA secret government agency recruits some of th...David AyerWill Smith, Jared Leto, Margot Robbie, Viola D...20161236.2393727325.0240.0cat_42.64
\n", + "
" + ], + "text/plain": [ + " Rank Title Genre \\\n", + "0 1 Guardians of the Galaxy Action,Adventure,Sci-Fi \n", + "1 2 Prometheus Adventure,Mystery,Sci-Fi \n", + "2 3 Split Horror,Thriller \n", + "3 4 Sing Animation,Comedy,Family \n", + "4 5 Suicide Squad Action,Adventure,Fantasy \n", + "\n", + " Description Director \\\n", + "0 A group of intergalactic criminals are forced ... James Gunn \n", + "1 Following clues to the origin of mankind, a te... Ridley Scott \n", + "2 Three girls are kidnapped by a man with a diag... M. Night Shyamalan \n", + "3 In a city of humanoid animals, a hustling thea... Christophe Lourdelet \n", + "4 A secret government agency recruits some of th... David Ayer \n", + "\n", + " Actors Year Runtime (Minutes) \\\n", + "0 Chris Pratt, Vin Diesel, Bradley Cooper, Zoe S... 2014 121 \n", + "1 Noomi Rapace, Logan Marshall-Green, Michael Fa... 2012 124 \n", + "2 James McAvoy, Anya Taylor-Joy, Haley Lu Richar... 2016 117 \n", + "3 Matthew McConaughey,Reese Witherspoon, Seth Ma... 2016 108 \n", + "4 Will Smith, Jared Leto, Margot Robbie, Viola D... 2016 123 \n", + "\n", + " Rating Votes Revenue (Millions) Metascore bin Revenue per minute \n", + "0 8.1 757074 333.13 76.0 cat_4 2.75 \n", + "1 7.0 485820 126.46 65.0 cat_4 1.02 \n", + "2 7.3 157606 138.12 62.0 cat_4 1.18 \n", + "3 7.2 60545 270.32 59.0 cat_3 2.50 \n", + "4 6.2 393727 325.02 40.0 cat_4 2.64 " + ] + }, + "execution_count": 23, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "Movie_Data[\"Revenue per minute\"]= Movie_Data.apply(lambda row:(round(row[\"Revenue (Millions)\"]/row[\"Runtime (Minutes)\"],2)), axis = 1)\n", + "Movie_Data.head()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f7e33040", + "metadata": {}, + "outputs": [], + "source": [ + "def rating(x):\n", + " if x = \"Thriller\":\n", + " return x+=1\n", + " elif x >= 1000 and x <= 9999:\n", + " return \"cat_2\"\n", + " elif x >= 10000 and x <= 99999:\n", + " return \"cat_3\"\n", + " elif x >= 100000 and x <= 999999:\n", + " return \"cat_4\"\n", + " else:\n", + " return \"cat_5\"\n" + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "id": "4c95b5cd", + "metadata": {}, + "outputs": [ + { + "ename": "SyntaxError", + "evalue": "expected 'else' after 'if' expression (1993307749.py, line 1)", + "output_type": "error", + "traceback": [ + "\u001b[0;36m Cell \u001b[0;32mIn[27], line 1\u001b[0;36m\u001b[0m\n\u001b[0;31m Movie_Data[\"New rating\"]= Movie_Data.apply(lambda row:((row[\"Rating\"]+ 1) if \"Thriller\" in row[\"Genre\"] (row[\"Rating\"]- 1) elif \"Comedy\" in row[\"Genre\"] else row[\"Rating\"], axis = 1)\u001b[0m\n\u001b[0m ^\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m expected 'else' after 'if' expression\n" ] } ], "source": [ - "import this" + "Movie_Data[\"New rating\"]= Movie_Data.apply(lambda row:((row[\"Rating\"]+ 1) if \"Thriller\" in row[\"Genre\"] (row[\"Rating\"]- 1) elif \"Comedy\" in row[\"Genre\"] else row[\"Rating\"], axis = 1)\n", + "Movie_Data.head()" ] }, { "cell_type": "code", "execution_count": null, - "id": "d3c3dd76", + "id": "9224c819", "metadata": {}, "outputs": [], "source": [] @@ -59,9 +1547,9 @@ ], "metadata": { "kernelspec": { - "display_name": "Python [conda env:.conda-m1_env]", + "display_name": "Python (m1_env)", "language": "python", - "name": "conda-env-.conda-m1_env-py" + "name": "m1_env" }, "language_info": { "codemirror_mode": { @@ -73,7 +1561,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.16" + "version": "3.10.13" } }, "nbformat": 4, From 00f7dc45dd404c461f7d416ec7564580e93c6989 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CAna?= Date: Sat, 28 Oct 2023 21:02:38 +0200 Subject: [PATCH 2/2] workshop solved --- notebooks/your_code_here.ipynb | 948 +++++++++++++++++++++++++++++++-- 1 file changed, 917 insertions(+), 31 deletions(-) diff --git a/notebooks/your_code_here.ipynb b/notebooks/your_code_here.ipynb index 9b1df82..18ca08c 100644 --- a/notebooks/your_code_here.ipynb +++ b/notebooks/your_code_here.ipynb @@ -23,7 +23,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 2, "id": "d3c3dd76", "metadata": {}, "outputs": [], @@ -33,7 +33,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 3, "id": "ae4d8f12", "metadata": {}, "outputs": [ @@ -1089,7 +1089,7 @@ "49 130 3.7 987 NaN 16.0 " ] }, - "execution_count": 6, + "execution_count": 3, "metadata": {}, "output_type": "execute_result" } @@ -1100,9 +1100,11 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 4, "id": "16ff0751", - "metadata": {}, + "metadata": { + "scrolled": true + }, "outputs": [ { "name": "stdout", @@ -1134,9 +1136,17 @@ "Movie_Data.info()" ] }, + { + "cell_type": "markdown", + "id": "14c84b36", + "metadata": {}, + "source": [ + "## Challenge 1" + ] + }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 5, "id": "a728f7bc", "metadata": {}, "outputs": [], @@ -1156,7 +1166,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 6, "id": "6a8634a4", "metadata": { "scrolled": true @@ -1313,7 +1323,7 @@ "4 6.2 393727 325.02 40.0 cat_4 " ] }, - "execution_count": 20, + "execution_count": 6, "metadata": {}, "output_type": "execute_result" } @@ -1323,9 +1333,17 @@ "Movie_Data.head()" ] }, + { + "cell_type": "markdown", + "id": "54404bbb", + "metadata": {}, + "source": [ + "## Challenge 2" + ] + }, { "cell_type": "code", - "execution_count": 23, + "execution_count": 7, "id": "f43e9248", "metadata": {}, "outputs": [ @@ -1486,7 +1504,7 @@ "4 6.2 393727 325.02 40.0 cat_4 2.64 " ] }, - "execution_count": 23, + "execution_count": 7, "metadata": {}, "output_type": "execute_result" } @@ -1496,51 +1514,919 @@ "Movie_Data.head()" ] }, + { + "cell_type": "markdown", + "id": "3eb4e210", + "metadata": {}, + "source": [ + "## Challenge 3" + ] + }, { "cell_type": "code", - "execution_count": null, - "id": "f7e33040", + "execution_count": 8, + "id": "4b70ee32", "metadata": {}, "outputs": [], "source": [ - "def rating(x):\n", - " if x = \"Thriller\":\n", - " return x+=1\n", - " elif x >= 1000 and x <= 9999:\n", - " return \"cat_2\"\n", - " elif x >= 10000 and x <= 99999:\n", - " return \"cat_3\"\n", - " elif x >= 100000 and x <= 999999:\n", - " return \"cat_4\"\n", + "def rates(x, y):\n", + " if \"Thriller\" in x:\n", + " return y +1\n", + " elif \"Comedy\" in x:\n", + " return y - 1\n", " else:\n", - " return \"cat_5\"\n" + " return y\n", + " " ] }, { "cell_type": "code", - "execution_count": 27, + "execution_count": 9, "id": "4c95b5cd", "metadata": {}, "outputs": [ { - "ename": "SyntaxError", - "evalue": "expected 'else' after 'if' expression (1993307749.py, line 1)", - "output_type": "error", - "traceback": [ - "\u001b[0;36m Cell \u001b[0;32mIn[27], line 1\u001b[0;36m\u001b[0m\n\u001b[0;31m Movie_Data[\"New rating\"]= Movie_Data.apply(lambda row:((row[\"Rating\"]+ 1) if \"Thriller\" in row[\"Genre\"] (row[\"Rating\"]- 1) elif \"Comedy\" in row[\"Genre\"] else row[\"Rating\"], axis = 1)\u001b[0m\n\u001b[0m ^\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m expected 'else' after 'if' expression\n" - ] + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
RankTitleGenreDescriptionDirectorActorsYearRuntime (Minutes)RatingVotesRevenue (Millions)MetascorebinRevenue per minuteNew rating
01Guardians of the GalaxyAction,Adventure,Sci-FiA group of intergalactic criminals are forced ...James GunnChris Pratt, Vin Diesel, Bradley Cooper, Zoe S...20141218.1757074333.1376.0cat_42.758.1
12PrometheusAdventure,Mystery,Sci-FiFollowing clues to the origin of mankind, a te...Ridley ScottNoomi Rapace, Logan Marshall-Green, Michael Fa...20121247.0485820126.4665.0cat_41.027.0
23SplitHorror,ThrillerThree girls are kidnapped by a man with a diag...M. Night ShyamalanJames McAvoy, Anya Taylor-Joy, Haley Lu Richar...20161177.3157606138.1262.0cat_41.188.3
34SingAnimation,Comedy,FamilyIn a city of humanoid animals, a hustling thea...Christophe LourdeletMatthew McConaughey,Reese Witherspoon, Seth Ma...20161087.260545270.3259.0cat_32.506.2
45Suicide SquadAction,Adventure,FantasyA secret government agency recruits some of th...David AyerWill Smith, Jared Leto, Margot Robbie, Viola D...20161236.2393727325.0240.0cat_42.646.2
\n", + "
" + ], + "text/plain": [ + " Rank Title Genre \\\n", + "0 1 Guardians of the Galaxy Action,Adventure,Sci-Fi \n", + "1 2 Prometheus Adventure,Mystery,Sci-Fi \n", + "2 3 Split Horror,Thriller \n", + "3 4 Sing Animation,Comedy,Family \n", + "4 5 Suicide Squad Action,Adventure,Fantasy \n", + "\n", + " Description Director \\\n", + "0 A group of intergalactic criminals are forced ... James Gunn \n", + "1 Following clues to the origin of mankind, a te... Ridley Scott \n", + "2 Three girls are kidnapped by a man with a diag... M. Night Shyamalan \n", + "3 In a city of humanoid animals, a hustling thea... Christophe Lourdelet \n", + "4 A secret government agency recruits some of th... David Ayer \n", + "\n", + " Actors Year Runtime (Minutes) \\\n", + "0 Chris Pratt, Vin Diesel, Bradley Cooper, Zoe S... 2014 121 \n", + "1 Noomi Rapace, Logan Marshall-Green, Michael Fa... 2012 124 \n", + "2 James McAvoy, Anya Taylor-Joy, Haley Lu Richar... 2016 117 \n", + "3 Matthew McConaughey,Reese Witherspoon, Seth Ma... 2016 108 \n", + "4 Will Smith, Jared Leto, Margot Robbie, Viola D... 2016 123 \n", + "\n", + " Rating Votes Revenue (Millions) Metascore bin Revenue per minute \\\n", + "0 8.1 757074 333.13 76.0 cat_4 2.75 \n", + "1 7.0 485820 126.46 65.0 cat_4 1.02 \n", + "2 7.3 157606 138.12 62.0 cat_4 1.18 \n", + "3 7.2 60545 270.32 59.0 cat_3 2.50 \n", + "4 6.2 393727 325.02 40.0 cat_4 2.64 \n", + "\n", + " New rating \n", + "0 8.1 \n", + "1 7.0 \n", + "2 8.3 \n", + "3 6.2 \n", + "4 6.2 " + ] + }, + "execution_count": 9, + "metadata": {}, + "output_type": "execute_result" } ], "source": [ - "Movie_Data[\"New rating\"]= Movie_Data.apply(lambda row:((row[\"Rating\"]+ 1) if \"Thriller\" in row[\"Genre\"] (row[\"Rating\"]- 1) elif \"Comedy\" in row[\"Genre\"] else row[\"Rating\"], axis = 1)\n", + "Movie_Data[\"New rating\"]= Movie_Data.apply(lambda row:rates(row[\"Genre\"],row[\"Rating\"]), axis = 1)\n", "Movie_Data.head()" ] }, + { + "cell_type": "markdown", + "id": "ffecdf18", + "metadata": {}, + "source": [ + "## Challenge 4" + ] + }, { "cell_type": "code", - "execution_count": null, + "execution_count": 10, + "id": "b3755d5a", + "metadata": {}, + "outputs": [], + "source": [ + "def check(x):\n", + " if x < 2:\n", + " return False\n", + " elif x == 2:\n", + " return True\n", + " elif x > 2:\n", + " for i in range(2, x):\n", + " if x % i == 0:\n", + " return False\n", + " return True" + ] + }, + { + "cell_type": "code", + "execution_count": 11, "id": "9224c819", "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
RankTitleGenreDescriptionDirectorActorsYearRuntime (Minutes)RatingVotesRevenue (Millions)MetascorebinRevenue per minuteNew ratingWeird Prime check
01Guardians of the GalaxyAction,Adventure,Sci-FiA group of intergalactic criminals are forced ...James GunnChris Pratt, Vin Diesel, Bradley Cooper, Zoe S...20141218.1757074333.1376.0cat_42.758.1False
12PrometheusAdventure,Mystery,Sci-FiFollowing clues to the origin of mankind, a te...Ridley ScottNoomi Rapace, Logan Marshall-Green, Michael Fa...20121247.0485820126.4665.0cat_41.027.0False
23SplitHorror,ThrillerThree girls are kidnapped by a man with a diag...M. Night ShyamalanJames McAvoy, Anya Taylor-Joy, Haley Lu Richar...20161177.3157606138.1262.0cat_41.188.3False
34SingAnimation,Comedy,FamilyIn a city of humanoid animals, a hustling thea...Christophe LourdeletMatthew McConaughey,Reese Witherspoon, Seth Ma...20161087.260545270.3259.0cat_32.506.2False
45Suicide SquadAction,Adventure,FantasyA secret government agency recruits some of th...David AyerWill Smith, Jared Leto, Margot Robbie, Viola D...20161236.2393727325.0240.0cat_42.646.2False
\n", + "
" + ], + "text/plain": [ + " Rank Title Genre \\\n", + "0 1 Guardians of the Galaxy Action,Adventure,Sci-Fi \n", + "1 2 Prometheus Adventure,Mystery,Sci-Fi \n", + "2 3 Split Horror,Thriller \n", + "3 4 Sing Animation,Comedy,Family \n", + "4 5 Suicide Squad Action,Adventure,Fantasy \n", + "\n", + " Description Director \\\n", + "0 A group of intergalactic criminals are forced ... James Gunn \n", + "1 Following clues to the origin of mankind, a te... Ridley Scott \n", + "2 Three girls are kidnapped by a man with a diag... M. Night Shyamalan \n", + "3 In a city of humanoid animals, a hustling thea... Christophe Lourdelet \n", + "4 A secret government agency recruits some of th... David Ayer \n", + "\n", + " Actors Year Runtime (Minutes) \\\n", + "0 Chris Pratt, Vin Diesel, Bradley Cooper, Zoe S... 2014 121 \n", + "1 Noomi Rapace, Logan Marshall-Green, Michael Fa... 2012 124 \n", + "2 James McAvoy, Anya Taylor-Joy, Haley Lu Richar... 2016 117 \n", + "3 Matthew McConaughey,Reese Witherspoon, Seth Ma... 2016 108 \n", + "4 Will Smith, Jared Leto, Margot Robbie, Viola D... 2016 123 \n", + "\n", + " Rating Votes Revenue (Millions) Metascore bin Revenue per minute \\\n", + "0 8.1 757074 333.13 76.0 cat_4 2.75 \n", + "1 7.0 485820 126.46 65.0 cat_4 1.02 \n", + "2 7.3 157606 138.12 62.0 cat_4 1.18 \n", + "3 7.2 60545 270.32 59.0 cat_3 2.50 \n", + "4 6.2 393727 325.02 40.0 cat_4 2.64 \n", + "\n", + " New rating Weird Prime check \n", + "0 8.1 False \n", + "1 7.0 False \n", + "2 8.3 False \n", + "3 6.2 False \n", + "4 6.2 False " + ] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "Movie_Data[\"Weird Prime check\"]= Movie_Data.apply(lambda row:(check(int((sum(ord(c) for c in row[\"Actors\"]))/row[\"Votes\"]))), axis = 1)\n", + "Movie_Data.head()" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "id": "9840f0dd", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Weird Prime check\n", + "False 965\n", + "True 35\n", + "Name: count, dtype: int64" + ] + }, + "execution_count": 12, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "Movie_Data[\"Weird Prime check\"].value_counts()" + ] + }, + { + "cell_type": "markdown", + "id": "cd01eb83", + "metadata": {}, + "source": [ + "## Challenge 5" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "id": "533a14bc", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
RankTitleGenreDescriptionDirectorActorsYearRuntime (Minutes)RatingVotesRevenue (Millions)MetascorebinRevenue per minuteNew ratingWeird Prime checkRevenue per votes in top films
677678Love, RosieComedy,RomanceRosie and Alex have been best friends since th...Christian DitterLily Collins, Sam Claflin, Christian Cooke, Ja...20141027.2804150.0144.0cat_30.06.2False8041500.00
755756The RoadAdventure,DramaIn a dangerous post-apocalyptic world, an aili...John HillcoatViggo Mortensen, Charlize Theron, Kodi Smit-Mc...20091117.31873020.06NaNcat_40.07.3False3121700.00
435436FilthComedy,Crime,DramaA corrupt, junkie cop with bipolar disorder at...Jon S. BairdJames McAvoy, Jamie Bell, Eddie Marsan, Imogen...2013977.1813010.03NaNcat_30.06.1False2710033.33
913914CoherenceMystery,Sci-Fi,ThrillerStrange things begin to happen when a group of...James Ward ByrkitEmily Baldoni, Maury Sterling, Nicholas Brendo...2013897.2662650.0765.0cat_30.08.2False946642.86
402403BronsonAction,Biography,CrimeA young man who was sentenced to seven years i...Nicolas Winding RefnTom Hardy, Kelly Adams, Luing Andrews,Katy Barker2008927.1939720.10NaNcat_30.07.1False939720.00
\n", + "
" + ], + "text/plain": [ + " Rank Title Genre \\\n", + "677 678 Love, Rosie Comedy,Romance \n", + "755 756 The Road Adventure,Drama \n", + "435 436 Filth Comedy,Crime,Drama \n", + "913 914 Coherence Mystery,Sci-Fi,Thriller \n", + "402 403 Bronson Action,Biography,Crime \n", + "\n", + " Description Director \\\n", + "677 Rosie and Alex have been best friends since th... Christian Ditter \n", + "755 In a dangerous post-apocalyptic world, an aili... John Hillcoat \n", + "435 A corrupt, junkie cop with bipolar disorder at... Jon S. Baird \n", + "913 Strange things begin to happen when a group of... James Ward Byrkit \n", + "402 A young man who was sentenced to seven years i... Nicolas Winding Refn \n", + "\n", + " Actors Year \\\n", + "677 Lily Collins, Sam Claflin, Christian Cooke, Ja... 2014 \n", + "755 Viggo Mortensen, Charlize Theron, Kodi Smit-Mc... 2009 \n", + "435 James McAvoy, Jamie Bell, Eddie Marsan, Imogen... 2013 \n", + "913 Emily Baldoni, Maury Sterling, Nicholas Brendo... 2013 \n", + "402 Tom Hardy, Kelly Adams, Luing Andrews,Katy Barker 2008 \n", + "\n", + " Runtime (Minutes) Rating Votes Revenue (Millions) Metascore bin \\\n", + "677 102 7.2 80415 0.01 44.0 cat_3 \n", + "755 111 7.3 187302 0.06 NaN cat_4 \n", + "435 97 7.1 81301 0.03 NaN cat_3 \n", + "913 89 7.2 66265 0.07 65.0 cat_3 \n", + "402 92 7.1 93972 0.10 NaN cat_3 \n", + "\n", + " Revenue per minute New rating Weird Prime check \\\n", + "677 0.0 6.2 False \n", + "755 0.0 7.3 False \n", + "435 0.0 6.1 False \n", + "913 0.0 8.2 False \n", + "402 0.0 7.1 False \n", + "\n", + " Revenue per votes in top films \n", + "677 8041500.00 \n", + "755 3121700.00 \n", + "435 2710033.33 \n", + "913 946642.86 \n", + "402 939720.00 " + ] + }, + "execution_count": 13, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "\n", + "Movie_Data[\"Revenue per votes in top films\"] = round(Movie_Data.loc[Movie_Data[\"Rating\"] > 7, \"Votes\"] / Movie_Data[\"Revenue (Millions)\"],2)\n", + "\n", + "Movie_Data[\"Revenue per votes in top films\"].fillna(0, inplace=True)\n", + "\n", + "\n", + "Movie_Data.sort_values(by=\"Revenue per votes in top films\", ascending=False, inplace=True)\n", + "\n", + "\n", + "Movie_Data.head()\n" + ] + }, + { + "cell_type": "markdown", + "id": "0228ac86", + "metadata": {}, + "source": [ + "## Bonus Challenge" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "id": "38c2f0f8", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
RankTitleGenreDescriptionDirectorActorsYearRuntime (Minutes)RatingVotesRevenue (Millions)MetascorebinRevenue per minuteNew ratingWeird Prime checkRevenue per votes in top filmsDescription Numeric Sum
113114300Action,Fantasy,WarKing Leonidas of Sparta and a force of 300 men...Zack SnyderGerard Butler, Lena Headey, David Wenham, Domi...20061177.7637104210.5952.0cat_41.807.7False3025.33270
361362ClownHorror,ThrillerA loving father finds a clown suit for his son...Jon WattsAndy Powers, Laura Allen, Peter Stormare, Chri...20141005.7142480.0542.0cat_30.006.7False0.00250
497498Super 8Mystery,Sci-Fi,ThrillerDuring the summer of 1979, a group of friends ...J.J. AbramsElle Fanning, AJ Michalka, Kyle Chandler, Joel...20111127.1298913126.9872.0cat_41.138.1False2354.02244
758759Conan the BarbarianAction,Adventure,FantasyA vengeful barbarian warrior sets off to get h...Marcus NispelJason Momoa, Ron Perlman, Rose McGowan,Stephen...20111135.28489321.27NaNcat_30.195.2False0.00243
525526Birth of the DragonAction,Biography,DramaYoung, up-and-coming martial artist, Bruce Lee...George NolfiBilly Magnussen, Terry Chen, Teresa Navarro,Va...20161033.955293.0561.0cat_10.903.9False0.00241
\n", + "
" + ], + "text/plain": [ + " Rank Title Genre \\\n", + "113 114 300 Action,Fantasy,War \n", + "361 362 Clown Horror,Thriller \n", + "497 498 Super 8 Mystery,Sci-Fi,Thriller \n", + "758 759 Conan the Barbarian Action,Adventure,Fantasy \n", + "525 526 Birth of the Dragon Action,Biography,Drama \n", + "\n", + " Description Director \\\n", + "113 King Leonidas of Sparta and a force of 300 men... Zack Snyder \n", + "361 A loving father finds a clown suit for his son... Jon Watts \n", + "497 During the summer of 1979, a group of friends ... J.J. Abrams \n", + "758 A vengeful barbarian warrior sets off to get h... Marcus Nispel \n", + "525 Young, up-and-coming martial artist, Bruce Lee... George Nolfi \n", + "\n", + " Actors Year \\\n", + "113 Gerard Butler, Lena Headey, David Wenham, Domi... 2006 \n", + "361 Andy Powers, Laura Allen, Peter Stormare, Chri... 2014 \n", + "497 Elle Fanning, AJ Michalka, Kyle Chandler, Joel... 2011 \n", + "758 Jason Momoa, Ron Perlman, Rose McGowan,Stephen... 2011 \n", + "525 Billy Magnussen, Terry Chen, Teresa Navarro,Va... 2016 \n", + "\n", + " Runtime (Minutes) Rating Votes Revenue (Millions) Metascore bin \\\n", + "113 117 7.7 637104 210.59 52.0 cat_4 \n", + "361 100 5.7 14248 0.05 42.0 cat_3 \n", + "497 112 7.1 298913 126.98 72.0 cat_4 \n", + "758 113 5.2 84893 21.27 NaN cat_3 \n", + "525 103 3.9 552 93.05 61.0 cat_1 \n", + "\n", + " Revenue per minute New rating Weird Prime check \\\n", + "113 1.80 7.7 False \n", + "361 0.00 6.7 False \n", + "497 1.13 8.1 False \n", + "758 0.19 5.2 False \n", + "525 0.90 3.9 False \n", + "\n", + " Revenue per votes in top films Description Numeric Sum \n", + "113 3025.33 270 \n", + "361 0.00 250 \n", + "497 2354.02 244 \n", + "758 0.00 243 \n", + "525 0.00 241 " + ] + }, + "execution_count": 17, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "import hashlib\n", + "\n", + "def calculate_numeric_sum_sha256(value):\n", + " hash_value = hashlib.sha256(str(value).encode()).hexdigest()\n", + " numeric_sum = sum(int(c, 16) for c in hash_value if c.isnumeric())\n", + " return numeric_sum\n", + "\n", + "Movie_Data[\"Description Numeric Sum\"] = Movie_Data[\"Description\"].apply(calculate_numeric_sum_sha256)\n", + "\n", + "hidden_pattern_movies = Movie_Data[\n", + " (Movie_Data[\"Description Numeric Sum\"] >= Movie_Data[\"Revenue (Millions)\"]) &\n", + " (Movie_Data[\"Description Numeric Sum\"] <= Movie_Data[\"Votes\"])\n", + "]\n", + "hidden_pattern_movies = hidden_pattern_movies.sort_values(by=\"Description Numeric Sum\", ascending=False)\n", + "\n", + "hidden_pattern_movies.head()\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "86331e2a", + "metadata": {}, "outputs": [], "source": [] }