| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698 |
- {
- "cells": [
- {
- "cell_type": "code",
- "execution_count": 1,
- "metadata": {},
- "outputs": [
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "/var/folders/dv/107570dd01b_m3wvmvv0g9lm0000gn/T/ipykernel_18673/1882081200.py:4: DtypeWarning: Columns (10) have mixed types. Specify dtype option on import or set low_memory=False.\n",
- " df = pd.read_csv('../data/movies_metadata.csv')\n"
- ]
- },
- {
- "data": {
- "text/html": [
- "<div>\n",
- "<style scoped>\n",
- " .dataframe tbody tr th:only-of-type {\n",
- " vertical-align: middle;\n",
- " }\n",
- "\n",
- " .dataframe tbody tr th {\n",
- " vertical-align: top;\n",
- " }\n",
- "\n",
- " .dataframe thead th {\n",
- " text-align: right;\n",
- " }\n",
- "</style>\n",
- "<table border=\"1\" class=\"dataframe\">\n",
- " <thead>\n",
- " <tr style=\"text-align: right;\">\n",
- " <th></th>\n",
- " <th>adult</th>\n",
- " <th>belongs_to_collection</th>\n",
- " <th>budget</th>\n",
- " <th>genres</th>\n",
- " <th>homepage</th>\n",
- " <th>id</th>\n",
- " <th>imdb_id</th>\n",
- " <th>original_language</th>\n",
- " <th>original_title</th>\n",
- " <th>overview</th>\n",
- " <th>...</th>\n",
- " <th>release_date</th>\n",
- " <th>revenue</th>\n",
- " <th>runtime</th>\n",
- " <th>spoken_languages</th>\n",
- " <th>status</th>\n",
- " <th>tagline</th>\n",
- " <th>title</th>\n",
- " <th>video</th>\n",
- " <th>vote_average</th>\n",
- " <th>vote_count</th>\n",
- " </tr>\n",
- " </thead>\n",
- " <tbody>\n",
- " <tr>\n",
- " <th>0</th>\n",
- " <td>False</td>\n",
- " <td>{'id': 10194, 'name': 'Toy Story Collection', ...</td>\n",
- " <td>30000000</td>\n",
- " <td>[{'id': 16, 'name': 'Animation'}, {'id': 35, '...</td>\n",
- " <td>http://toystory.disney.com/toy-story</td>\n",
- " <td>862</td>\n",
- " <td>tt0114709</td>\n",
- " <td>en</td>\n",
- " <td>Toy Story</td>\n",
- " <td>Led by Woody, Andy's toys live happily in his ...</td>\n",
- " <td>...</td>\n",
- " <td>1995-10-30</td>\n",
- " <td>373554033.0</td>\n",
- " <td>81.0</td>\n",
- " <td>[{'iso_639_1': 'en', 'name': 'English'}]</td>\n",
- " <td>Released</td>\n",
- " <td>NaN</td>\n",
- " <td>Toy Story</td>\n",
- " <td>False</td>\n",
- " <td>7.7</td>\n",
- " <td>5415.0</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>1</th>\n",
- " <td>False</td>\n",
- " <td>NaN</td>\n",
- " <td>65000000</td>\n",
- " <td>[{'id': 12, 'name': 'Adventure'}, {'id': 14, '...</td>\n",
- " <td>NaN</td>\n",
- " <td>8844</td>\n",
- " <td>tt0113497</td>\n",
- " <td>en</td>\n",
- " <td>Jumanji</td>\n",
- " <td>When siblings Judy and Peter discover an encha...</td>\n",
- " <td>...</td>\n",
- " <td>1995-12-15</td>\n",
- " <td>262797249.0</td>\n",
- " <td>104.0</td>\n",
- " <td>[{'iso_639_1': 'en', 'name': 'English'}, {'iso...</td>\n",
- " <td>Released</td>\n",
- " <td>Roll the dice and unleash the excitement!</td>\n",
- " <td>Jumanji</td>\n",
- " <td>False</td>\n",
- " <td>6.9</td>\n",
- " <td>2413.0</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>2</th>\n",
- " <td>False</td>\n",
- " <td>{'id': 119050, 'name': 'Grumpy Old Men Collect...</td>\n",
- " <td>0</td>\n",
- " <td>[{'id': 10749, 'name': 'Romance'}, {'id': 35, ...</td>\n",
- " <td>NaN</td>\n",
- " <td>15602</td>\n",
- " <td>tt0113228</td>\n",
- " <td>en</td>\n",
- " <td>Grumpier Old Men</td>\n",
- " <td>A family wedding reignites the ancient feud be...</td>\n",
- " <td>...</td>\n",
- " <td>1995-12-22</td>\n",
- " <td>0.0</td>\n",
- " <td>101.0</td>\n",
- " <td>[{'iso_639_1': 'en', 'name': 'English'}]</td>\n",
- " <td>Released</td>\n",
- " <td>Still Yelling. Still Fighting. Still Ready for...</td>\n",
- " <td>Grumpier Old Men</td>\n",
- " <td>False</td>\n",
- " <td>6.5</td>\n",
- " <td>92.0</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>3</th>\n",
- " <td>False</td>\n",
- " <td>NaN</td>\n",
- " <td>16000000</td>\n",
- " <td>[{'id': 35, 'name': 'Comedy'}, {'id': 18, 'nam...</td>\n",
- " <td>NaN</td>\n",
- " <td>31357</td>\n",
- " <td>tt0114885</td>\n",
- " <td>en</td>\n",
- " <td>Waiting to Exhale</td>\n",
- " <td>Cheated on, mistreated and stepped on, the wom...</td>\n",
- " <td>...</td>\n",
- " <td>1995-12-22</td>\n",
- " <td>81452156.0</td>\n",
- " <td>127.0</td>\n",
- " <td>[{'iso_639_1': 'en', 'name': 'English'}]</td>\n",
- " <td>Released</td>\n",
- " <td>Friends are the people who let you be yourself...</td>\n",
- " <td>Waiting to Exhale</td>\n",
- " <td>False</td>\n",
- " <td>6.1</td>\n",
- " <td>34.0</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>4</th>\n",
- " <td>False</td>\n",
- " <td>{'id': 96871, 'name': 'Father of the Bride Col...</td>\n",
- " <td>0</td>\n",
- " <td>[{'id': 35, 'name': 'Comedy'}]</td>\n",
- " <td>NaN</td>\n",
- " <td>11862</td>\n",
- " <td>tt0113041</td>\n",
- " <td>en</td>\n",
- " <td>Father of the Bride Part II</td>\n",
- " <td>Just when George Banks has recovered from his ...</td>\n",
- " <td>...</td>\n",
- " <td>1995-02-10</td>\n",
- " <td>76578911.0</td>\n",
- " <td>106.0</td>\n",
- " <td>[{'iso_639_1': 'en', 'name': 'English'}]</td>\n",
- " <td>Released</td>\n",
- " <td>Just When His World Is Back To Normal... He's ...</td>\n",
- " <td>Father of the Bride Part II</td>\n",
- " <td>False</td>\n",
- " <td>5.7</td>\n",
- " <td>173.0</td>\n",
- " </tr>\n",
- " </tbody>\n",
- "</table>\n",
- "<p>5 rows × 24 columns</p>\n",
- "</div>"
- ],
- "text/plain": [
- " adult belongs_to_collection budget \\\n",
- "0 False {'id': 10194, 'name': 'Toy Story Collection', ... 30000000 \n",
- "1 False NaN 65000000 \n",
- "2 False {'id': 119050, 'name': 'Grumpy Old Men Collect... 0 \n",
- "3 False NaN 16000000 \n",
- "4 False {'id': 96871, 'name': 'Father of the Bride Col... 0 \n",
- "\n",
- " genres \\\n",
- "0 [{'id': 16, 'name': 'Animation'}, {'id': 35, '... \n",
- "1 [{'id': 12, 'name': 'Adventure'}, {'id': 14, '... \n",
- "2 [{'id': 10749, 'name': 'Romance'}, {'id': 35, ... \n",
- "3 [{'id': 35, 'name': 'Comedy'}, {'id': 18, 'nam... \n",
- "4 [{'id': 35, 'name': 'Comedy'}] \n",
- "\n",
- " homepage id imdb_id original_language \\\n",
- "0 http://toystory.disney.com/toy-story 862 tt0114709 en \n",
- "1 NaN 8844 tt0113497 en \n",
- "2 NaN 15602 tt0113228 en \n",
- "3 NaN 31357 tt0114885 en \n",
- "4 NaN 11862 tt0113041 en \n",
- "\n",
- " original_title \\\n",
- "0 Toy Story \n",
- "1 Jumanji \n",
- "2 Grumpier Old Men \n",
- "3 Waiting to Exhale \n",
- "4 Father of the Bride Part II \n",
- "\n",
- " overview ... release_date \\\n",
- "0 Led by Woody, Andy's toys live happily in his ... ... 1995-10-30 \n",
- "1 When siblings Judy and Peter discover an encha... ... 1995-12-15 \n",
- "2 A family wedding reignites the ancient feud be... ... 1995-12-22 \n",
- "3 Cheated on, mistreated and stepped on, the wom... ... 1995-12-22 \n",
- "4 Just when George Banks has recovered from his ... ... 1995-02-10 \n",
- "\n",
- " revenue runtime spoken_languages \\\n",
- "0 373554033.0 81.0 [{'iso_639_1': 'en', 'name': 'English'}] \n",
- "1 262797249.0 104.0 [{'iso_639_1': 'en', 'name': 'English'}, {'iso... \n",
- "2 0.0 101.0 [{'iso_639_1': 'en', 'name': 'English'}] \n",
- "3 81452156.0 127.0 [{'iso_639_1': 'en', 'name': 'English'}] \n",
- "4 76578911.0 106.0 [{'iso_639_1': 'en', 'name': 'English'}] \n",
- "\n",
- " status tagline \\\n",
- "0 Released NaN \n",
- "1 Released Roll the dice and unleash the excitement! \n",
- "2 Released Still Yelling. Still Fighting. Still Ready for... \n",
- "3 Released Friends are the people who let you be yourself... \n",
- "4 Released Just When His World Is Back To Normal... He's ... \n",
- "\n",
- " title video vote_average vote_count \n",
- "0 Toy Story False 7.7 5415.0 \n",
- "1 Jumanji False 6.9 2413.0 \n",
- "2 Grumpier Old Men False 6.5 92.0 \n",
- "3 Waiting to Exhale False 6.1 34.0 \n",
- "4 Father of the Bride Part II False 5.7 173.0 \n",
- "\n",
- "[5 rows x 24 columns]"
- ]
- },
- "execution_count": 1,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "import pandas as pd\n",
- "import numpy as np\n",
- "\n",
- "df = pd.read_csv('../data/movies_metadata.csv')\n",
- "df.head()"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 2,
- "metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "50.0"
- ]
- },
- "execution_count": 2,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "#Calculate the number of votes garnered by the 80th percentile movie\n",
- "m = df['vote_count'].quantile(0.80)\n",
- "m"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 3,
- "metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "(8963, 24)"
- ]
- },
- "execution_count": 3,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "#Only consider movies longer than 45 minutes and shorter than 300 minutes\n",
- "q_movies = df[(df['runtime'] >= 45) & (df['runtime'] <= 300)]\n",
- "\n",
- "#Only consider movies that have garnered more than m votes\n",
- "q_movies = q_movies[q_movies['vote_count'] >= m]\n",
- "\n",
- "#Inspect the number of movies that made the cut\n",
- "q_movies.shape"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 4,
- "metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "5.618207215134185"
- ]
- },
- "execution_count": 4,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "# Calculate C\n",
- "C = df['vote_average'].mean()\n",
- "C"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 5,
- "metadata": {},
- "outputs": [],
- "source": [
- "# Function to compute the IMDB weighted rating for each movie\n",
- "def weighted_rating(x, m=m, C=C):\n",
- " v = x['vote_count']\n",
- " R = x['vote_average']\n",
- " # Compute the weighted score\n",
- " return (v/(v+m) * R) + (m/(m+v) * C)"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 6,
- "metadata": {},
- "outputs": [],
- "source": [
- "# Compute the score using the weighted_rating function defined above\n",
- "q_movies['score'] = q_movies.apply(weighted_rating, axis=1)"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 7,
- "metadata": {},
- "outputs": [
- {
- "data": {
- "text/html": [
- "<div>\n",
- "<style scoped>\n",
- " .dataframe tbody tr th:only-of-type {\n",
- " vertical-align: middle;\n",
- " }\n",
- "\n",
- " .dataframe tbody tr th {\n",
- " vertical-align: top;\n",
- " }\n",
- "\n",
- " .dataframe thead th {\n",
- " text-align: right;\n",
- " }\n",
- "</style>\n",
- "<table border=\"1\" class=\"dataframe\">\n",
- " <thead>\n",
- " <tr style=\"text-align: right;\">\n",
- " <th></th>\n",
- " <th>title</th>\n",
- " <th>vote_count</th>\n",
- " <th>vote_average</th>\n",
- " <th>score</th>\n",
- " <th>runtime</th>\n",
- " </tr>\n",
- " </thead>\n",
- " <tbody>\n",
- " <tr>\n",
- " <th>10309</th>\n",
- " <td>Dilwale Dulhania Le Jayenge</td>\n",
- " <td>661.0</td>\n",
- " <td>9.1</td>\n",
- " <td>8.855148</td>\n",
- " <td>190.0</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>314</th>\n",
- " <td>The Shawshank Redemption</td>\n",
- " <td>8358.0</td>\n",
- " <td>8.5</td>\n",
- " <td>8.482863</td>\n",
- " <td>142.0</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>834</th>\n",
- " <td>The Godfather</td>\n",
- " <td>6024.0</td>\n",
- " <td>8.5</td>\n",
- " <td>8.476278</td>\n",
- " <td>175.0</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>40251</th>\n",
- " <td>Your Name.</td>\n",
- " <td>1030.0</td>\n",
- " <td>8.5</td>\n",
- " <td>8.366584</td>\n",
- " <td>106.0</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>12481</th>\n",
- " <td>The Dark Knight</td>\n",
- " <td>12269.0</td>\n",
- " <td>8.3</td>\n",
- " <td>8.289115</td>\n",
- " <td>152.0</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>2843</th>\n",
- " <td>Fight Club</td>\n",
- " <td>9678.0</td>\n",
- " <td>8.3</td>\n",
- " <td>8.286216</td>\n",
- " <td>139.0</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>292</th>\n",
- " <td>Pulp Fiction</td>\n",
- " <td>8670.0</td>\n",
- " <td>8.3</td>\n",
- " <td>8.284623</td>\n",
- " <td>154.0</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>522</th>\n",
- " <td>Schindler's List</td>\n",
- " <td>4436.0</td>\n",
- " <td>8.3</td>\n",
- " <td>8.270109</td>\n",
- " <td>195.0</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>23673</th>\n",
- " <td>Whiplash</td>\n",
- " <td>4376.0</td>\n",
- " <td>8.3</td>\n",
- " <td>8.269704</td>\n",
- " <td>105.0</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>5481</th>\n",
- " <td>Spirited Away</td>\n",
- " <td>3968.0</td>\n",
- " <td>8.3</td>\n",
- " <td>8.266628</td>\n",
- " <td>125.0</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>2211</th>\n",
- " <td>Life Is Beautiful</td>\n",
- " <td>3643.0</td>\n",
- " <td>8.3</td>\n",
- " <td>8.263691</td>\n",
- " <td>116.0</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>1178</th>\n",
- " <td>The Godfather: Part II</td>\n",
- " <td>3418.0</td>\n",
- " <td>8.3</td>\n",
- " <td>8.261335</td>\n",
- " <td>200.0</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>1152</th>\n",
- " <td>One Flew Over the Cuckoo's Nest</td>\n",
- " <td>3001.0</td>\n",
- " <td>8.3</td>\n",
- " <td>8.256051</td>\n",
- " <td>133.0</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>1176</th>\n",
- " <td>Psycho</td>\n",
- " <td>2405.0</td>\n",
- " <td>8.3</td>\n",
- " <td>8.245381</td>\n",
- " <td>109.0</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>351</th>\n",
- " <td>Forrest Gump</td>\n",
- " <td>8147.0</td>\n",
- " <td>8.2</td>\n",
- " <td>8.184252</td>\n",
- " <td>142.0</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>1184</th>\n",
- " <td>Once Upon a Time in America</td>\n",
- " <td>1104.0</td>\n",
- " <td>8.3</td>\n",
- " <td>8.183804</td>\n",
- " <td>229.0</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>1154</th>\n",
- " <td>The Empire Strikes Back</td>\n",
- " <td>5998.0</td>\n",
- " <td>8.2</td>\n",
- " <td>8.178656</td>\n",
- " <td>124.0</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>18465</th>\n",
- " <td>The Intouchables</td>\n",
- " <td>5410.0</td>\n",
- " <td>8.2</td>\n",
- " <td>8.176357</td>\n",
- " <td>112.0</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>289</th>\n",
- " <td>Leon: The Professional</td>\n",
- " <td>4293.0</td>\n",
- " <td>8.2</td>\n",
- " <td>8.170276</td>\n",
- " <td>110.0</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>3030</th>\n",
- " <td>The Green Mile</td>\n",
- " <td>4166.0</td>\n",
- " <td>8.2</td>\n",
- " <td>8.169381</td>\n",
- " <td>189.0</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>1170</th>\n",
- " <td>GoodFellas</td>\n",
- " <td>3211.0</td>\n",
- " <td>8.2</td>\n",
- " <td>8.160414</td>\n",
- " <td>145.0</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>2216</th>\n",
- " <td>American History X</td>\n",
- " <td>3120.0</td>\n",
- " <td>8.2</td>\n",
- " <td>8.159278</td>\n",
- " <td>119.0</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>1161</th>\n",
- " <td>12 Angry Men</td>\n",
- " <td>2130.0</td>\n",
- " <td>8.2</td>\n",
- " <td>8.140785</td>\n",
- " <td>96.0</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>9698</th>\n",
- " <td>Howl's Moving Castle</td>\n",
- " <td>2049.0</td>\n",
- " <td>8.2</td>\n",
- " <td>8.138499</td>\n",
- " <td>119.0</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>2884</th>\n",
- " <td>Princess Mononoke</td>\n",
- " <td>2041.0</td>\n",
- " <td>8.2</td>\n",
- " <td>8.138264</td>\n",
- " <td>134.0</td>\n",
- " </tr>\n",
- " </tbody>\n",
- "</table>\n",
- "</div>"
- ],
- "text/plain": [
- " title vote_count vote_average score \\\n",
- "10309 Dilwale Dulhania Le Jayenge 661.0 9.1 8.855148 \n",
- "314 The Shawshank Redemption 8358.0 8.5 8.482863 \n",
- "834 The Godfather 6024.0 8.5 8.476278 \n",
- "40251 Your Name. 1030.0 8.5 8.366584 \n",
- "12481 The Dark Knight 12269.0 8.3 8.289115 \n",
- "2843 Fight Club 9678.0 8.3 8.286216 \n",
- "292 Pulp Fiction 8670.0 8.3 8.284623 \n",
- "522 Schindler's List 4436.0 8.3 8.270109 \n",
- "23673 Whiplash 4376.0 8.3 8.269704 \n",
- "5481 Spirited Away 3968.0 8.3 8.266628 \n",
- "2211 Life Is Beautiful 3643.0 8.3 8.263691 \n",
- "1178 The Godfather: Part II 3418.0 8.3 8.261335 \n",
- "1152 One Flew Over the Cuckoo's Nest 3001.0 8.3 8.256051 \n",
- "1176 Psycho 2405.0 8.3 8.245381 \n",
- "351 Forrest Gump 8147.0 8.2 8.184252 \n",
- "1184 Once Upon a Time in America 1104.0 8.3 8.183804 \n",
- "1154 The Empire Strikes Back 5998.0 8.2 8.178656 \n",
- "18465 The Intouchables 5410.0 8.2 8.176357 \n",
- "289 Leon: The Professional 4293.0 8.2 8.170276 \n",
- "3030 The Green Mile 4166.0 8.2 8.169381 \n",
- "1170 GoodFellas 3211.0 8.2 8.160414 \n",
- "2216 American History X 3120.0 8.2 8.159278 \n",
- "1161 12 Angry Men 2130.0 8.2 8.140785 \n",
- "9698 Howl's Moving Castle 2049.0 8.2 8.138499 \n",
- "2884 Princess Mononoke 2041.0 8.2 8.138264 \n",
- "\n",
- " runtime \n",
- "10309 190.0 \n",
- "314 142.0 \n",
- "834 175.0 \n",
- "40251 106.0 \n",
- "12481 152.0 \n",
- "2843 139.0 \n",
- "292 154.0 \n",
- "522 195.0 \n",
- "23673 105.0 \n",
- "5481 125.0 \n",
- "2211 116.0 \n",
- "1178 200.0 \n",
- "1152 133.0 \n",
- "1176 109.0 \n",
- "351 142.0 \n",
- "1184 229.0 \n",
- "1154 124.0 \n",
- "18465 112.0 \n",
- "289 110.0 \n",
- "3030 189.0 \n",
- "1170 145.0 \n",
- "2216 119.0 \n",
- "1161 96.0 \n",
- "9698 119.0 \n",
- "2884 134.0 "
- ]
- },
- "execution_count": 7,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "#Sort movies in descending order of their scores\n",
- "q_movies = q_movies.sort_values('score', ascending=False)\n",
- "\n",
- "#Print the top 25 movies\n",
- "q_movies[['title', 'vote_count', 'vote_average', 'score', 'runtime']].head(25)"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {},
- "outputs": [],
- "source": []
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {},
- "outputs": [],
- "source": []
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Python 3 (ipykernel)",
- "language": "python",
- "name": "python3"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 3
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython3",
- "version": "3.10.4"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 2
- }
|