探索电影数据集
by Kimi
在这个项目中,你将尝试使用所学的知识,使用 NumPy
、Pandas
、matplotlib
、seaborn
库中的函数,来对电影数据集进行探索。
下载数据集:
TMDb电影数据
数据集各列名称的含义:
列名称 | id | imdb_id | popularity | budget | revenue | original_title | cast | homepage | director | tagline | keywords | overview | runtime | genres | production_companies | release_date | vote_count | vote_average | release_year | budget_adj | revenue_adj |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
含义 | 编号 | IMDB 编号 | 知名度 | 预算 | 票房 | 名称 | 主演 | 网站 | 导演 | 宣传词 | 关键词 | 简介 | 时常 | 类别 | 发行公司 | 发行日期 | 投票总数 | 投票均值 | 发行年份 | 预算(调整后) | 票房(调整后) |
请注意,你需要提交该报告导出的 .html
、.ipynb
以及 .py
文件。
第一节 数据的导入与处理
在这一部分,你需要编写代码,使用 Pandas 读取数据,并进行预处理。
任务1.1: 导入库以及数据
- 载入需要的库
NumPy
、Pandas
、matplotlib
、seaborn
。 - 利用
Pandas
库,读取tmdb-movies.csv
中的数据,保存为movie_data
。
提示:记得使用 notebook 中的魔法指令 %matplotlib inline
,否则会导致你接下来无法打印出图像。
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
%matplotlib inline
movie_data = pd.read_csv('tmdb-movies.csv', index_col=['id'])
movie_data.head()
imdb_id | popularity | budget | revenue | original_title | cast | homepage | director | tagline | keywords | overview | runtime | genres | production_companies | release_date | vote_count | vote_average | release_year | budget_adj | revenue_adj | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
id | ||||||||||||||||||||
135397 | tt0369610 | 32.985763 | 150000000 | 1513528810 | Jurassic World | Chris Pratt|Bryce Dallas Howard|Irrfan Khan|Vi... | http://www.jurassicworld.com/ | Colin Trevorrow | The park is open. | monster|dna|tyrannosaurus rex|velociraptor|island | Twenty-two years after the events of Jurassic ... | 124 | Action|Adventure|Science Fiction|Thriller | Universal Studios|Amblin Entertainment|Legenda... | 6/9/15 | 5562 | 6.5 | 2015 | 1.379999e+08 | 1.392446e+09 |
76341 | tt1392190 | 28.419936 | 150000000 | 378436354 | Mad Max: Fury Road | Tom Hardy|Charlize Theron|Hugh Keays-Byrne|Nic... | http://www.madmaxmovie.com/ | George Miller | What a Lovely Day. | future|chase|post-apocalyptic|dystopia|australia | An apocalyptic story set in the furthest reach... | 120 | Action|Adventure|Science Fiction|Thriller | Village Roadshow Pictures|Kennedy Miller Produ... | 5/13/15 | 6185 | 7.1 | 2015 | 1.379999e+08 | 3.481613e+08 |
262500 | tt2908446 | 13.112507 | 110000000 | 295238201 | Insurgent | Shailene Woodley|Theo James|Kate Winslet|Ansel... | http://www.thedivergentseries.movie/#insurgent | Robert Schwentke | One Choice Can Destroy You | based on novel|revolution|dystopia|sequel|dyst... | Beatrice Prior must confront her inner demons ... | 119 | Adventure|Science Fiction|Thriller | Summit Entertainment|Mandeville Films|Red Wago... | 3/18/15 | 2480 | 6.3 | 2015 | 1.012000e+08 | 2.716190e+08 |
140607 | tt2488496 | 11.173104 | 200000000 | 2068178225 | Star Wars: The Force Awakens | Harrison Ford|Mark Hamill|Carrie Fisher|Adam D... | http://www.starwars.com/films/star-wars-episod... | J.J. Abrams | Every generation has a story. | android|spaceship|jedi|space opera|3d | Thirty years after defeating the Galactic Empi... | 136 | Action|Adventure|Science Fiction|Fantasy | Lucasfilm|Truenorth Productions|Bad Robot | 12/15/15 | 5292 | 7.5 | 2015 | 1.839999e+08 | 1.902723e+09 |
168259 | tt2820852 | 9.335014 | 190000000 | 1506249360 | Furious 7 | Vin Diesel|Paul Walker|Jason Statham|Michelle ... | http://www.furious7.com/ | James Wan | Vengeance Hits Home | car race|speed|revenge|suspense|car | Deckard Shaw seeks revenge against Dominic Tor... | 137 | Action|Crime|Thriller | Universal Pictures|Original Film|Media Rights ... | 4/1/15 | 2947 | 7.3 | 2015 | 1.747999e+08 | 1.385749e+09 |
考察不同年份中, 不同电影类型的发行情况.
# 拆分电影类型
df_genres = movie_data.drop('genres', axis=1).join(movie_data['genres'].str.split('|', expand=True).stack().reset_index(level=1, drop=True).rename('genres'))
# 绘图区
fig, axes = plt.subplots(2, 1, figsize=(20, 10))
# 为了易于辨认, 只展示部分电影类型
top5_genres = df_genres['genres'].value_counts().nlargest(5).index
btm5_genres = df_genres['genres'].value_counts().nsmallest(5).index
# 作出中位数参考线
median_cir = df_genres.groupby('release_year')['genres'].value_counts().unstack().mean(axis=1)
median_cir.plot(ax=axes[0], ls='--', label='mean', legend=True)
median_cir.plot(ax=axes[1], ls='--', label='mean', legend=True)
# 按年份作图
vis_params = {'grid': True, 'marker': 'o', 'markersize': 2, 'linewidth': 1}
df_genres[df_genres['genres'].isin(top5_genres)] \
.groupby('release_year')['genres'].value_counts().unstack().fillna(0) \
.plot(ax=axes[0], title='circulation over years of top 5 genres', **vis_params)
df_genres[df_genres['genres'].isin(btm5_genres)] \
.groupby('release_year')['genres'].value_counts().unstack().fillna(0) \
.plot(ax=axes[1], title='circulation over years of bottom 5 genres', **vis_params)
plt.tight_layout()
按总收益来看, 哪些描述电影的关键字出现频率最多
#制作电影关键字的词云
from wordcloud import WordCloud
%config InlineBackend.figure_format = 'retina'
#用"|"分割的关键词 先分离出来
kw_expand = movie_data['keywords'].str.split('|', expand=True).stack().reset_index(level=1, drop=True).rename('keywords')
# 合并营收数据
df_kw_rev = movie_data[['revenue_adj']].join(kw_expand)
# 按照收入分类 生成字典
word_dict = df_kw_rev.groupby('keywords')['revenue_adj'].sum().to_dict()
# 创建词云
params = {'mode': 'RGBA',
'background_color': 'rgba(255, 255, 255, 0)',
'colormap': 'Spectral'}
wordcloud = WordCloud(width=1200, height=800, **params)
wordcloud.generate_from_frequencies(word_dict)
# 绘制词云
plt.figure(figsize=(15, 10))
plt.imshow(wordcloud, interpolation='bilinear')
plt.axis('off')
按总收益来看, 哪些电影类型的关键字出现频率最多
#制作电影关键字的词云
from wordcloud import WordCloud
%config InlineBackend.figure_format = 'retina'
#用"|"分割的关键词 先分离出来
kw_expand = movie_data['genres'].str.split('|', expand=True).stack().reset_index(level=1, drop=True).rename('genres')
# 合并营收数据
df_kw_rev = movie_data[['revenue_adj']].join(kw_expand)
# 按照收入分类 生成字典
word_dict = df_kw_rev.groupby('genres')['revenue_adj'].sum().to_dict()
# 创建词云
params = {'mode': 'RGBA',
'background_color': 'rgba(255, 255, 255, 0)',
'colormap': 'Spectral'}
wordcloud = WordCloud(width=1200, height=800, **params)
wordcloud.generate_from_frequencies(word_dict)
# 绘制词云
plt.figure(figsize=(15, 10))
plt.imshow(wordcloud, interpolation='bilinear')
plt.axis('off')
**任务1.2: ** 了解数据
你会接触到各种各样的数据表,因此在读取之后,我们有必要通过一些简单的方法,来了解我们数据表是什么样子的。
- 获取数据表的行列,并打印。
- 使用
.head()
、.tail()
、.sample()
方法,观察、了解数据表的情况。 - 使用
.dtypes
属性,来查看各列数据的数据类型。 - 使用
isnull()
配合.any()
等方法,来查看各列是否存在空值。 - 使用
.describe()
方法,看看数据表中数值型的数据是怎么分布的。
#获取数据表的行列
movie_data.shape
(10866, 20)
#使用head()
movie_data.head(10)
imdb_id | popularity | budget | revenue | original_title | cast | homepage | director | tagline | keywords | overview | runtime | genres | production_companies | release_date | vote_count | vote_average | release_year | budget_adj | revenue_adj | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
id | ||||||||||||||||||||
135397 | tt0369610 | 32.985763 | 150000000 | 1513528810 | Jurassic World | Chris Pratt|Bryce Dallas Howard|Irrfan Khan|Vi... | http://www.jurassicworld.com/ | Colin Trevorrow | The park is open. | monster|dna|tyrannosaurus rex|velociraptor|island | Twenty-two years after the events of Jurassic ... | 124 | Action|Adventure|Science Fiction|Thriller | Universal Studios|Amblin Entertainment|Legenda... | 6/9/15 | 5562 | 6.5 | 2015 | 1.379999e+08 | 1.392446e+09 |
76341 | tt1392190 | 28.419936 | 150000000 | 378436354 | Mad Max: Fury Road | Tom Hardy|Charlize Theron|Hugh Keays-Byrne|Nic... | http://www.madmaxmovie.com/ | George Miller | What a Lovely Day. | future|chase|post-apocalyptic|dystopia|australia | An apocalyptic story set in the furthest reach... | 120 | Action|Adventure|Science Fiction|Thriller | Village Roadshow Pictures|Kennedy Miller Produ... | 5/13/15 | 6185 | 7.1 | 2015 | 1.379999e+08 | 3.481613e+08 |
262500 | tt2908446 | 13.112507 | 110000000 | 295238201 | Insurgent | Shailene Woodley|Theo James|Kate Winslet|Ansel... | http://www.thedivergentseries.movie/#insurgent | Robert Schwentke | One Choice Can Destroy You | based on novel|revolution|dystopia|sequel|dyst... | Beatrice Prior must confront her inner demons ... | 119 | Adventure|Science Fiction|Thriller | Summit Entertainment|Mandeville Films|Red Wago... | 3/18/15 | 2480 | 6.3 | 2015 | 1.012000e+08 | 2.716190e+08 |
140607 | tt2488496 | 11.173104 | 200000000 | 2068178225 | Star Wars: The Force Awakens | Harrison Ford|Mark Hamill|Carrie Fisher|Adam D... | http://www.starwars.com/films/star-wars-episod... | J.J. Abrams | Every generation has a story. | android|spaceship|jedi|space opera|3d | Thirty years after defeating the Galactic Empi... | 136 | Action|Adventure|Science Fiction|Fantasy | Lucasfilm|Truenorth Productions|Bad Robot | 12/15/15 | 5292 | 7.5 | 2015 | 1.839999e+08 | 1.902723e+09 |
168259 | tt2820852 | 9.335014 | 190000000 | 1506249360 | Furious 7 | Vin Diesel|Paul Walker|Jason Statham|Michelle ... | http://www.furious7.com/ | James Wan | Vengeance Hits Home | car race|speed|revenge|suspense|car | Deckard Shaw seeks revenge against Dominic Tor... | 137 | Action|Crime|Thriller | Universal Pictures|Original Film|Media Rights ... | 4/1/15 | 2947 | 7.3 | 2015 | 1.747999e+08 | 1.385749e+09 |
281957 | tt1663202 | 9.110700 | 135000000 | 532950503 | The Revenant | Leonardo DiCaprio|Tom Hardy|Will Poulter|Domhn... | http://www.foxmovies.com/movies/the-revenant | Alejandro González Iñárritu | (n. One who has returned, as if from the dead.) | father-son relationship|rape|based on novel|mo... | In the 1820s, a frontiersman, Hugh Glass, sets... | 156 | Western|Drama|Adventure|Thriller | Regency Enterprises|Appian Way|CatchPlay|Anony... | 12/25/15 | 3929 | 7.2 | 2015 | 1.241999e+08 | 4.903142e+08 |
87101 | tt1340138 | 8.654359 | 155000000 | 440603537 | Terminator Genisys | Arnold Schwarzenegger|Jason Clarke|Emilia Clar... | http://www.terminatormovie.com/ | Alan Taylor | Reset the future | saving the world|artificial intelligence|cybor... | The year is 2029. John Connor, leader of the r... | 125 | Science Fiction|Action|Thriller|Adventure | Paramount Pictures|Skydance Productions | 6/23/15 | 2598 | 5.8 | 2015 | 1.425999e+08 | 4.053551e+08 |
286217 | tt3659388 | 7.667400 | 108000000 | 595380321 | The Martian | Matt Damon|Jessica Chastain|Kristen Wiig|Jeff ... | http://www.foxmovies.com/movies/the-martian | Ridley Scott | Bring Him Home | based on novel|mars|nasa|isolation|botanist | During a manned mission to Mars, Astronaut Mar... | 141 | Drama|Adventure|Science Fiction | Twentieth Century Fox Film Corporation|Scott F... | 9/30/15 | 4572 | 7.6 | 2015 | 9.935996e+07 | 5.477497e+08 |
211672 | tt2293640 | 7.404165 | 74000000 | 1156730962 | Minions | Sandra Bullock|Jon Hamm|Michael Keaton|Allison... | http://www.minionsmovie.com/ | Kyle Balda|Pierre Coffin | Before Gru, they had a history of bad bosses | assistant|aftercreditsstinger|duringcreditssti... | Minions Stuart, Kevin and Bob are recruited by... | 91 | Family|Animation|Adventure|Comedy | Universal Pictures|Illumination Entertainment | 6/17/15 | 2893 | 6.5 | 2015 | 6.807997e+07 | 1.064192e+09 |
150540 | tt2096673 | 6.326804 | 175000000 | 853708609 | Inside Out | Amy Poehler|Phyllis Smith|Richard Kind|Bill Ha... | http://movies.disney.com/inside-out | Pete Docter | Meet the little voices inside your head. | dream|cartoon|imaginary friend|animation|kid | Growing up can be a bumpy road, and it's no ex... | 94 | Comedy|Animation|Family | Walt Disney Pictures|Pixar Animation Studios|W... | 6/9/15 | 3935 | 8.0 | 2015 | 1.609999e+08 | 7.854116e+08 |
# 使用tail
movie_data.tail(2)
imdb_id | popularity | budget | revenue | original_title | cast | homepage | director | tagline | keywords | overview | runtime | genres | production_companies | release_date | vote_count | vote_average | release_year | budget_adj | revenue_adj | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
id | ||||||||||||||||||||
21449 | tt0061177 | 0.064317 | 0 | 0 | What's Up, Tiger Lily? | Tatsuya Mihashi|Akiko Wakabayashi|Mie Hama|Joh... | NaN | Woody Allen | WOODY ALLEN STRIKES BACK! | spoof | In comic Woody Allen's film debut, he took the... | 80 | Action|Comedy | Benedict Pictures Corp. | 11/2/66 | 22 | 5.4 | 1966 | 0.000000 | 0.0 |
22293 | tt0060666 | 0.035919 | 19000 | 0 | Manos: The Hands of Fate | Harold P. Warren|Tom Neyman|John Reynolds|Dian... | NaN | Harold P. Warren | It's Shocking! It's Beyond Your Imagination! | fire|gun|drive|sacrifice|flashlight | A family gets lost on the road and stumbles up... | 74 | Horror | Norm-Iris | 11/15/66 | 15 | 1.5 | 1966 | 127642.279154 | 0.0 |
# 使用sample
movie_data.sample(5)
imdb_id | popularity | budget | revenue | original_title | cast | homepage | director | tagline | keywords | overview | runtime | genres | production_companies | release_date | vote_count | vote_average | release_year | budget_adj | revenue_adj | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
id | ||||||||||||||||||||
76163 | tt1764651 | 2.415046 | 100000000 | 312573423 | The Expendables 2 | Sylvester Stallone|Jason Statham|Dolph Lundgre... | http://theexpendables2film.com/ | Simon West | Back for War. | number in title|plane crash|violence|beard|ens... | Mr. Church reunites the Expendables for what s... | 103 | Action|Adventure|Thriller | Nu Image Films|Millennium Films | 8/8/12 | 2218 | 6.0 | 2012 | 9.497443e+07 | 2.968648e+08 |
280000 | tt2396436 | 0.487316 | 0 | 0 | Lemon Tree Passage | Jessica Tovey|Nicholas Gunn|Pippa Black|Tim Ph... | NaN | David Campbell | NaN | NaN | An Australian urban legend comes screaming on ... | 84 | Thriller|Horror|Mystery | Thirteen Disciples | 8/25/14 | 15 | 4.8 | 2014 | 0.000000e+00 | 0.000000e+00 |
380 | tt0095953 | 1.459821 | 25000000 | 354825435 | Rain Man | Dustin Hoffman|Tom Cruise|Valeria Golino|Geral... | NaN | Barry Levinson | A journey through understanding and fellowship. | individual|mentally disabled|autism|loss of fa... | Selfish yuppie Charlie Babbitt's father left a... | 133 | Drama | United Artists|Star Partners II Ltd. | 12/11/88 | 934 | 7.4 | 1988 | 4.609728e+07 | 6.542594e+08 |
11062 | tt0115907 | 0.571393 | 0 | 0 | City Hall | Al Pacino|John Cusack|Bridget Fonda|Danny Aiel... | NaN | Harold Becker | It started with a shootout on a rainswept stre... | corruption|undercover|war on drugs|mayor|drug ... | The accidental shooting of a boy in New York l... | 111 | Drama|Thriller | Columbia Pictures|Castle Rock Entertainment | 2/16/96 | 31 | 5.9 | 1996 | 0.000000e+00 | 0.000000e+00 |
217 | tt0367882 | 3.161670 | 185000000 | 786636033 | Indiana Jones and the Kingdom of the Crystal S... | Harrison Ford|Cate Blanchett|Shia LaBeouf|Ray ... | http://www.indianajones.com/site/index.html | Steven Spielberg | The adventure continues . . . | saving the world|riddle|whip|treasure|mexico city | Set during the Cold War, the Soviets – led b... | 122 | Adventure|Action | Lucasfilm|Paramount Pictures | 5/21/08 | 1537 | 5.6 | 2008 | 1.873655e+08 | 7.966945e+08 |
# 使用dtypes
movie_data.dtypes
imdb_id object
popularity float64
budget int64
revenue int64
original_title object
cast object
homepage object
director object
tagline object
keywords object
overview object
runtime int64
genres object
production_companies object
release_date object
vote_count int64
vote_average float64
release_year int64
budget_adj float64
revenue_adj float64
dtype: object
#判断是否是空值
movie_data.isnull().any()
imdb_id True
popularity False
budget False
revenue False
original_title False
cast True
homepage True
director True
tagline True
keywords True
overview True
runtime False
genres True
production_companies True
release_date False
vote_count False
vote_average False
release_year False
budget_adj False
revenue_adj False
dtype: bool
# 使用describe 方法
movie_data.describe()
popularity | budget | revenue | runtime | vote_count | vote_average | release_year | budget_adj | revenue_adj | |
---|---|---|---|---|---|---|---|---|---|
count | 10866.000000 | 1.086600e+04 | 1.086600e+04 | 10866.000000 | 10866.000000 | 10866.000000 | 10866.000000 | 1.086600e+04 | 1.086600e+04 |
mean | 0.646441 | 1.462570e+07 | 3.982332e+07 | 102.070863 | 217.389748 | 5.974922 | 2001.322658 | 1.755104e+07 | 5.136436e+07 |
std | 1.000185 | 3.091321e+07 | 1.170035e+08 | 31.381405 | 575.619058 | 0.935142 | 12.812941 | 3.430616e+07 | 1.446325e+08 |
min | 0.000065 | 0.000000e+00 | 0.000000e+00 | 0.000000 | 10.000000 | 1.500000 | 1960.000000 | 0.000000e+00 | 0.000000e+00 |
25% | 0.207583 | 0.000000e+00 | 0.000000e+00 | 90.000000 | 17.000000 | 5.400000 | 1995.000000 | 0.000000e+00 | 0.000000e+00 |
50% | 0.383856 | 0.000000e+00 | 0.000000e+00 | 99.000000 | 38.000000 | 6.000000 | 2006.000000 | 0.000000e+00 | 0.000000e+00 |
75% | 0.713817 | 1.500000e+07 | 2.400000e+07 | 111.000000 | 145.750000 | 6.600000 | 2011.000000 | 2.085325e+07 | 3.369710e+07 |
max | 32.985763 | 4.250000e+08 | 2.781506e+09 | 900.000000 | 9767.000000 | 9.200000 | 2015.000000 | 4.250000e+08 | 2.827124e+09 |
**任务1.3: ** 清理数据
在真实的工作场景中,数据处理往往是最为费时费力的环节。但是幸运的是,我们提供给大家的 tmdb 数据集非常的「干净」,不需要大家做特别多的数据清洗以及处理工作。在这一步中,你的核心的工作主要是对数据表中的空值进行处理。你可以使用 .fillna()
来填补空值,当然也可以使用 .dropna()
来丢弃数据表中包含空值的某些行或者列。
任务:使用适当的方法来清理空值,并将得到的数据保存。
#查看空值
movie_data.info()
<class 'pandas.core.frame.DataFrame'>
Int64Index: 10866 entries, 135397 to 22293
Data columns (total 20 columns):
imdb_id 10856 non-null object
popularity 10866 non-null float64
budget 10866 non-null int64
revenue 10866 non-null int64
original_title 10866 non-null object
cast 10790 non-null object
homepage 2936 non-null object
director 10822 non-null object
tagline 8042 non-null object
keywords 9373 non-null object
overview 10862 non-null object
runtime 10866 non-null int64
genres 10843 non-null object
production_companies 9836 non-null object
release_date 10866 non-null object
vote_count 10866 non-null int64
vote_average 10866 non-null float64
release_year 10866 non-null int64
budget_adj 10866 non-null float64
revenue_adj 10866 non-null float64
dtypes: float64(4), int64(5), object(11)
memory usage: 1.7+ MB
# 删除一些无关紧要 又带空值的列
movie_data.drop( ['homepage', 'tagline','keywords'],axis = 1,inplace = True)
#删除没有id的行
movie_data = movie_data.dropna(axis=0,subset = ["imdb_id"])
movie_data.fillna('无', inplace=True)
movie_data.info()
<class 'pandas.core.frame.DataFrame'>
Int64Index: 10856 entries, 135397 to 22293
Data columns (total 17 columns):
imdb_id 10856 non-null object
popularity 10856 non-null float64
budget 10856 non-null int64
revenue 10856 non-null int64
original_title 10856 non-null object
cast 10856 non-null object
director 10856 non-null object
overview 10856 non-null object
runtime 10856 non-null int64
genres 10856 non-null object
production_companies 10856 non-null object
release_date 10856 non-null object
vote_count 10856 non-null int64
vote_average 10856 non-null float64
release_year 10856 non-null int64
budget_adj 10856 non-null float64
revenue_adj 10856 non-null float64
dtypes: float64(4), int64(5), object(8)
memory usage: 1.5+ MB
第二节 根据指定要求读取数据
相比 Excel 等数据分析软件,Pandas 的一大特长在于,能够轻松地基于复杂的逻辑选择合适的数据。因此,如何根据指定的要求,从数据表当获取适当的数据,是使用 Pandas 中非常重要的技能,也是本节重点考察大家的内容。
**任务2.1: ** 简单读取
- 读取数据表中名为
id
、popularity
、budget
、runtime
、vote_average
列的数据。 - 读取数据表中前1~20行以及48、49行的数据。
- 读取数据表中第50~60行的
popularity
那一列的数据。
要求:每一个语句只能用一行代码实现。
#1. 读取数据表中名为 `id`、`popularity`、`budget`、`runtime`、`vote_average` 列的数据。
movie_data[['imdb_id', 'popularity','budget', 'runtime', 'vote_average']]
imdb_id | popularity | budget | runtime | vote_average | |
---|---|---|---|---|---|
id | |||||
135397 | tt0369610 | 32.985763 | 150000000 | 124 | 6.5 |
76341 | tt1392190 | 28.419936 | 150000000 | 120 | 7.1 |
262500 | tt2908446 | 13.112507 | 110000000 | 119 | 6.3 |
140607 | tt2488496 | 11.173104 | 200000000 | 136 | 7.5 |
168259 | tt2820852 | 9.335014 | 190000000 | 137 | 7.3 |
281957 | tt1663202 | 9.110700 | 135000000 | 156 | 7.2 |
87101 | tt1340138 | 8.654359 | 155000000 | 125 | 5.8 |
286217 | tt3659388 | 7.667400 | 108000000 | 141 | 7.6 |
211672 | tt2293640 | 7.404165 | 74000000 | 91 | 6.5 |
150540 | tt2096673 | 6.326804 | 175000000 | 94 | 8.0 |
206647 | tt2379713 | 6.200282 | 245000000 | 148 | 6.2 |
76757 | tt1617661 | 6.189369 | 176000003 | 124 | 5.2 |
264660 | tt0470752 | 6.118847 | 15000000 | 108 | 7.6 |
257344 | tt2120120 | 5.984995 | 88000000 | 105 | 5.8 |
99861 | tt2395427 | 5.944927 | 280000000 | 141 | 7.4 |
273248 | tt3460252 | 5.898400 | 44000000 | 167 | 7.4 |
260346 | tt2446042 | 5.749758 | 48000000 | 109 | 6.1 |
102899 | tt0478970 | 5.573184 | 130000000 | 115 | 7.0 |
150689 | tt1661199 | 5.556818 | 95000000 | 112 | 6.8 |
131634 | tt1951266 | 5.476958 | 160000000 | 136 | 6.5 |
158852 | tt1964418 | 5.462138 | 190000000 | 130 | 6.2 |
307081 | tt1798684 | 5.337064 | 30000000 | 123 | 7.3 |
254128 | tt2126355 | 4.907832 | 110000000 | 114 | 6.1 |
216015 | tt2322441 | 4.710402 | 40000000 | 125 | 5.3 |
318846 | tt1596363 | 4.648046 | 28000000 | 130 | 7.3 |
177677 | tt2381249 | 4.566713 | 150000000 | 131 | 7.1 |
214756 | tt2637276 | 4.564549 | 68000000 | 115 | 6.3 |
207703 | tt2802144 | 4.503789 | 81000000 | 130 | 7.6 |
314365 | tt1895587 | 4.062293 | 20000000 | 128 | 7.8 |
294254 | tt4046784 | 3.968891 | 61000000 | 132 | 6.4 |
... | ... | ... | ... | ... | ... |
38720 | tt0061170 | 0.239435 | 0 | 114 | 5.8 |
19728 | tt0060177 | 0.291704 | 0 | 156 | 5.5 |
22383 | tt0060862 | 0.151845 | 0 | 117 | 6.0 |
13353 | tt0060550 | 0.276133 | 0 | 25 | 7.2 |
34388 | tt0060437 | 0.102530 | 0 | 102 | 5.7 |
42701 | tt0062262 | 0.264925 | 75000 | 82 | 5.5 |
36540 | tt0061199 | 0.253437 | 0 | 25 | 7.9 |
29710 | tt0060588 | 0.252399 | 0 | 134 | 5.8 |
23728 | tt0059557 | 0.236098 | 0 | 108 | 5.6 |
5065 | tt0059014 | 0.230873 | 0 | 93 | 5.9 |
17102 | tt0059127 | 0.212716 | 0 | 90 | 5.7 |
28763 | tt0060548 | 0.034555 | 0 | 89 | 5.3 |
2161 | tt0060397 | 0.207257 | 5115000 | 100 | 6.7 |
28270 | tt0060445 | 0.206537 | 0 | 109 | 6.1 |
26268 | tt0060490 | 0.202473 | 0 | 121 | 6.0 |
15347 | tt0060182 | 0.342791 | 0 | 95 | 6.6 |
37301 | tt0060165 | 0.227220 | 0 | 95 | 6.0 |
15598 | tt0060086 | 0.163592 | 0 | 114 | 6.2 |
31602 | tt0060232 | 0.146402 | 0 | 135 | 6.0 |
13343 | tt0059221 | 0.141026 | 700000 | 90 | 6.1 |
20277 | tt0061135 | 0.140934 | 0 | 93 | 5.7 |
5921 | tt0060748 | 0.131378 | 0 | 128 | 5.9 |
31918 | tt0060921 | 0.317824 | 0 | 126 | 5.5 |
20620 | tt0060955 | 0.089072 | 0 | 100 | 6.6 |
5060 | tt0060214 | 0.087034 | 0 | 87 | 7.0 |
21 | tt0060371 | 0.080598 | 0 | 95 | 7.4 |
20379 | tt0060472 | 0.065543 | 0 | 176 | 5.7 |
39768 | tt0060161 | 0.065141 | 0 | 94 | 6.5 |
21449 | tt0061177 | 0.064317 | 0 | 80 | 5.4 |
22293 | tt0060666 | 0.035919 | 19000 | 74 | 1.5 |
10856 rows × 5 columns
#2. 读取数据表中前1~20行以及48、49行的数据。
# movie_data.iloc[0:20].append(movie_data.iloc[[47,48]])
movie_data.iloc[np.r_[0:20,47:49]]
imdb_id | popularity | budget | revenue | original_title | cast | director | overview | runtime | genres | production_companies | release_date | vote_count | vote_average | release_year | budget_adj | revenue_adj | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
id | |||||||||||||||||
135397 | tt0369610 | 32.985763 | 150000000 | 1513528810 | Jurassic World | Chris Pratt|Bryce Dallas Howard|Irrfan Khan|Vi... | Colin Trevorrow | Twenty-two years after the events of Jurassic ... | 124 | Action|Adventure|Science Fiction|Thriller | Universal Studios|Amblin Entertainment|Legenda... | 6/9/15 | 5562 | 6.5 | 2015 | 1.379999e+08 | 1.392446e+09 |
76341 | tt1392190 | 28.419936 | 150000000 | 378436354 | Mad Max: Fury Road | Tom Hardy|Charlize Theron|Hugh Keays-Byrne|Nic... | George Miller | An apocalyptic story set in the furthest reach... | 120 | Action|Adventure|Science Fiction|Thriller | Village Roadshow Pictures|Kennedy Miller Produ... | 5/13/15 | 6185 | 7.1 | 2015 | 1.379999e+08 | 3.481613e+08 |
262500 | tt2908446 | 13.112507 | 110000000 | 295238201 | Insurgent | Shailene Woodley|Theo James|Kate Winslet|Ansel... | Robert Schwentke | Beatrice Prior must confront her inner demons ... | 119 | Adventure|Science Fiction|Thriller | Summit Entertainment|Mandeville Films|Red Wago... | 3/18/15 | 2480 | 6.3 | 2015 | 1.012000e+08 | 2.716190e+08 |
140607 | tt2488496 | 11.173104 | 200000000 | 2068178225 | Star Wars: The Force Awakens | Harrison Ford|Mark Hamill|Carrie Fisher|Adam D... | J.J. Abrams | Thirty years after defeating the Galactic Empi... | 136 | Action|Adventure|Science Fiction|Fantasy | Lucasfilm|Truenorth Productions|Bad Robot | 12/15/15 | 5292 | 7.5 | 2015 | 1.839999e+08 | 1.902723e+09 |
168259 | tt2820852 | 9.335014 | 190000000 | 1506249360 | Furious 7 | Vin Diesel|Paul Walker|Jason Statham|Michelle ... | James Wan | Deckard Shaw seeks revenge against Dominic Tor... | 137 | Action|Crime|Thriller | Universal Pictures|Original Film|Media Rights ... | 4/1/15 | 2947 | 7.3 | 2015 | 1.747999e+08 | 1.385749e+09 |
281957 | tt1663202 | 9.110700 | 135000000 | 532950503 | The Revenant | Leonardo DiCaprio|Tom Hardy|Will Poulter|Domhn... | Alejandro González Iñárritu | In the 1820s, a frontiersman, Hugh Glass, sets... | 156 | Western|Drama|Adventure|Thriller | Regency Enterprises|Appian Way|CatchPlay|Anony... | 12/25/15 | 3929 | 7.2 | 2015 | 1.241999e+08 | 4.903142e+08 |
87101 | tt1340138 | 8.654359 | 155000000 | 440603537 | Terminator Genisys | Arnold Schwarzenegger|Jason Clarke|Emilia Clar... | Alan Taylor | The year is 2029. John Connor, leader of the r... | 125 | Science Fiction|Action|Thriller|Adventure | Paramount Pictures|Skydance Productions | 6/23/15 | 2598 | 5.8 | 2015 | 1.425999e+08 | 4.053551e+08 |
286217 | tt3659388 | 7.667400 | 108000000 | 595380321 | The Martian | Matt Damon|Jessica Chastain|Kristen Wiig|Jeff ... | Ridley Scott | During a manned mission to Mars, Astronaut Mar... | 141 | Drama|Adventure|Science Fiction | Twentieth Century Fox Film Corporation|Scott F... | 9/30/15 | 4572 | 7.6 | 2015 | 9.935996e+07 | 5.477497e+08 |
211672 | tt2293640 | 7.404165 | 74000000 | 1156730962 | Minions | Sandra Bullock|Jon Hamm|Michael Keaton|Allison... | Kyle Balda|Pierre Coffin | Minions Stuart, Kevin and Bob are recruited by... | 91 | Family|Animation|Adventure|Comedy | Universal Pictures|Illumination Entertainment | 6/17/15 | 2893 | 6.5 | 2015 | 6.807997e+07 | 1.064192e+09 |
150540 | tt2096673 | 6.326804 | 175000000 | 853708609 | Inside Out | Amy Poehler|Phyllis Smith|Richard Kind|Bill Ha... | Pete Docter | Growing up can be a bumpy road, and it's no ex... | 94 | Comedy|Animation|Family | Walt Disney Pictures|Pixar Animation Studios|W... | 6/9/15 | 3935 | 8.0 | 2015 | 1.609999e+08 | 7.854116e+08 |
206647 | tt2379713 | 6.200282 | 245000000 | 880674609 | Spectre | Daniel Craig|Christoph Waltz|Léa Seydoux|Ralp... | Sam Mendes | A cryptic message from Bond’s past sends him... | 148 | Action|Adventure|Crime | Columbia Pictures|Danjaq|B24 | 10/26/15 | 3254 | 6.2 | 2015 | 2.253999e+08 | 8.102203e+08 |
76757 | tt1617661 | 6.189369 | 176000003 | 183987723 | Jupiter Ascending | Mila Kunis|Channing Tatum|Sean Bean|Eddie Redm... | Lana Wachowski|Lilly Wachowski | In a universe where human genetic material is ... | 124 | Science Fiction|Fantasy|Action|Adventure | Village Roadshow Pictures|Dune Entertainment|A... | 2/4/15 | 1937 | 5.2 | 2015 | 1.619199e+08 | 1.692686e+08 |
264660 | tt0470752 | 6.118847 | 15000000 | 36869414 | Ex Machina | Domhnall Gleeson|Alicia Vikander|Oscar Isaac|S... | Alex Garland | Caleb, a 26 year old coder at the world's larg... | 108 | Drama|Science Fiction | DNA Films|Universal Pictures International (UP... | 1/21/15 | 2854 | 7.6 | 2015 | 1.379999e+07 | 3.391985e+07 |
257344 | tt2120120 | 5.984995 | 88000000 | 243637091 | Pixels | Adam Sandler|Michelle Monaghan|Peter Dinklage|... | Chris Columbus | Video game experts are recruited by the milita... | 105 | Action|Comedy|Science Fiction | Columbia Pictures|Happy Madison Productions | 7/16/15 | 1575 | 5.8 | 2015 | 8.095996e+07 | 2.241460e+08 |
99861 | tt2395427 | 5.944927 | 280000000 | 1405035767 | Avengers: Age of Ultron | Robert Downey Jr.|Chris Hemsworth|Mark Ruffalo... | Joss Whedon | When Tony Stark tries to jumpstart a dormant p... | 141 | Action|Adventure|Science Fiction | Marvel Studios|Prime Focus|Revolution Sun Studios | 4/22/15 | 4304 | 7.4 | 2015 | 2.575999e+08 | 1.292632e+09 |
273248 | tt3460252 | 5.898400 | 44000000 | 155760117 | The Hateful Eight | Samuel L. Jackson|Kurt Russell|Jennifer Jason ... | Quentin Tarantino | Bounty hunters seek shelter from a raging bliz... | 167 | Crime|Drama|Mystery|Western | Double Feature Films|The Weinstein Company|Fil... | 12/25/15 | 2389 | 7.4 | 2015 | 4.047998e+07 | 1.432992e+08 |
260346 | tt2446042 | 5.749758 | 48000000 | 325771424 | Taken 3 | Liam Neeson|Forest Whitaker|Maggie Grace|Famke... | Olivier Megaton | Ex-government operative Bryan Mills finds his ... | 109 | Crime|Action|Thriller | Twentieth Century Fox Film Corporation|M6 Film... | 1/1/15 | 1578 | 6.1 | 2015 | 4.415998e+07 | 2.997096e+08 |
102899 | tt0478970 | 5.573184 | 130000000 | 518602163 | Ant-Man | Paul Rudd|Michael Douglas|Evangeline Lilly|Cor... | Peyton Reed | Armed with the astonishing ability to shrink i... | 115 | Science Fiction|Action|Adventure | Marvel Studios | 7/14/15 | 3779 | 7.0 | 2015 | 1.195999e+08 | 4.771138e+08 |
150689 | tt1661199 | 5.556818 | 95000000 | 542351353 | Cinderella | Lily James|Cate Blanchett|Richard Madden|Helen... | Kenneth Branagh | When her father unexpectedly passes away, youn... | 112 | Romance|Fantasy|Family|Drama | Walt Disney Pictures|Genre Films|Beagle Pug Fi... | 3/12/15 | 1495 | 6.8 | 2015 | 8.739996e+07 | 4.989630e+08 |
131634 | tt1951266 | 5.476958 | 160000000 | 650523427 | The Hunger Games: Mockingjay - Part 2 | Jennifer Lawrence|Josh Hutcherson|Liam Hemswor... | Francis Lawrence | With the nation of Panem in a full scale war, ... | 136 | War|Adventure|Science Fiction | Studio Babelsberg|StudioCanal|Lionsgate|Walt D... | 11/18/15 | 2380 | 6.5 | 2015 | 1.471999e+08 | 5.984813e+08 |
286565 | tt3622592 | 2.968254 | 12000000 | 85512300 | Paper Towns | Nat Wolff|Cara Delevingne|Halston Sage|Justice... | Jake Schreier | Quentin Jacobsen has spent a lifetime loving t... | 109 | Drama|Mystery|Romance | Fox 2000 Pictures | 7/9/15 | 1252 | 6.2 | 2015 | 1.104000e+07 | 7.867128e+07 |
265208 | tt2231253 | 2.932340 | 30000000 | 0 | Wild Card | Jason Statham|Michael Angarano|Milo Ventimigli... | Simon West | When a Las Vegas bodyguard with lethal skills ... | 92 | Thriller|Crime|Drama | Current Entertainment|Lionsgate|Sierra / Affin... | 1/14/15 | 481 | 5.3 | 2015 | 2.759999e+07 | 0.000000e+00 |
#3. 读取数据表中第50~60行的 `popularity` 那一列的数据。
movie_data.iloc[49:60].loc[:, ['popularity']]
popularity | |
---|---|
id | |
254320 | 2.885126 |
258480 | 2.883233 |
257211 | 2.814802 |
253412 | 2.798017 |
274479 | 2.793297 |
257088 | 2.614499 |
295964 | 2.584264 |
238615 | 2.578919 |
210860 | 2.575711 |
306819 | 2.557859 |
201088 | 2.550747 |
**任务2.2: **逻辑读取(Logical Indexing)
- 读取数据表中
popularity
大于5 的所有数据。 - 读取数据表中
popularity
大于5 的所有数据且发行年份在1996年之后的所有数据。
提示:Pandas 中的逻辑运算符如 &
、|
,分别代表且
以及或
。
要求:请使用 Logical Indexing实现。
#读取数据表中 popularity 大于5 的所有数据。
movie_data[movie_data['popularity'] > 5]
imdb_id | popularity | budget | revenue | original_title | cast | director | overview | runtime | genres | production_companies | release_date | vote_count | vote_average | release_year | budget_adj | revenue_adj | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
id | |||||||||||||||||
135397 | tt0369610 | 32.985763 | 150000000 | 1513528810 | Jurassic World | Chris Pratt|Bryce Dallas Howard|Irrfan Khan|Vi... | Colin Trevorrow | Twenty-two years after the events of Jurassic ... | 124 | Action|Adventure|Science Fiction|Thriller | Universal Studios|Amblin Entertainment|Legenda... | 6/9/15 | 5562 | 6.5 | 2015 | 1.379999e+08 | 1.392446e+09 |
76341 | tt1392190 | 28.419936 | 150000000 | 378436354 | Mad Max: Fury Road | Tom Hardy|Charlize Theron|Hugh Keays-Byrne|Nic... | George Miller | An apocalyptic story set in the furthest reach... | 120 | Action|Adventure|Science Fiction|Thriller | Village Roadshow Pictures|Kennedy Miller Produ... | 5/13/15 | 6185 | 7.1 | 2015 | 1.379999e+08 | 3.481613e+08 |
262500 | tt2908446 | 13.112507 | 110000000 | 295238201 | Insurgent | Shailene Woodley|Theo James|Kate Winslet|Ansel... | Robert Schwentke | Beatrice Prior must confront her inner demons ... | 119 | Adventure|Science Fiction|Thriller | Summit Entertainment|Mandeville Films|Red Wago... | 3/18/15 | 2480 | 6.3 | 2015 | 1.012000e+08 | 2.716190e+08 |
140607 | tt2488496 | 11.173104 | 200000000 | 2068178225 | Star Wars: The Force Awakens | Harrison Ford|Mark Hamill|Carrie Fisher|Adam D... | J.J. Abrams | Thirty years after defeating the Galactic Empi... | 136 | Action|Adventure|Science Fiction|Fantasy | Lucasfilm|Truenorth Productions|Bad Robot | 12/15/15 | 5292 | 7.5 | 2015 | 1.839999e+08 | 1.902723e+09 |
168259 | tt2820852 | 9.335014 | 190000000 | 1506249360 | Furious 7 | Vin Diesel|Paul Walker|Jason Statham|Michelle ... | James Wan | Deckard Shaw seeks revenge against Dominic Tor... | 137 | Action|Crime|Thriller | Universal Pictures|Original Film|Media Rights ... | 4/1/15 | 2947 | 7.3 | 2015 | 1.747999e+08 | 1.385749e+09 |
281957 | tt1663202 | 9.110700 | 135000000 | 532950503 | The Revenant | Leonardo DiCaprio|Tom Hardy|Will Poulter|Domhn... | Alejandro González Iñárritu | In the 1820s, a frontiersman, Hugh Glass, sets... | 156 | Western|Drama|Adventure|Thriller | Regency Enterprises|Appian Way|CatchPlay|Anony... | 12/25/15 | 3929 | 7.2 | 2015 | 1.241999e+08 | 4.903142e+08 |
87101 | tt1340138 | 8.654359 | 155000000 | 440603537 | Terminator Genisys | Arnold Schwarzenegger|Jason Clarke|Emilia Clar... | Alan Taylor | The year is 2029. John Connor, leader of the r... | 125 | Science Fiction|Action|Thriller|Adventure | Paramount Pictures|Skydance Productions | 6/23/15 | 2598 | 5.8 | 2015 | 1.425999e+08 | 4.053551e+08 |
286217 | tt3659388 | 7.667400 | 108000000 | 595380321 | The Martian | Matt Damon|Jessica Chastain|Kristen Wiig|Jeff ... | Ridley Scott | During a manned mission to Mars, Astronaut Mar... | 141 | Drama|Adventure|Science Fiction | Twentieth Century Fox Film Corporation|Scott F... | 9/30/15 | 4572 | 7.6 | 2015 | 9.935996e+07 | 5.477497e+08 |
211672 | tt2293640 | 7.404165 | 74000000 | 1156730962 | Minions | Sandra Bullock|Jon Hamm|Michael Keaton|Allison... | Kyle Balda|Pierre Coffin | Minions Stuart, Kevin and Bob are recruited by... | 91 | Family|Animation|Adventure|Comedy | Universal Pictures|Illumination Entertainment | 6/17/15 | 2893 | 6.5 | 2015 | 6.807997e+07 | 1.064192e+09 |
150540 | tt2096673 | 6.326804 | 175000000 | 853708609 | Inside Out | Amy Poehler|Phyllis Smith|Richard Kind|Bill Ha... | Pete Docter | Growing up can be a bumpy road, and it's no ex... | 94 | Comedy|Animation|Family | Walt Disney Pictures|Pixar Animation Studios|W... | 6/9/15 | 3935 | 8.0 | 2015 | 1.609999e+08 | 7.854116e+08 |
206647 | tt2379713 | 6.200282 | 245000000 | 880674609 | Spectre | Daniel Craig|Christoph Waltz|Léa Seydoux|Ralp... | Sam Mendes | A cryptic message from Bond’s past sends him... | 148 | Action|Adventure|Crime | Columbia Pictures|Danjaq|B24 | 10/26/15 | 3254 | 6.2 | 2015 | 2.253999e+08 | 8.102203e+08 |
76757 | tt1617661 | 6.189369 | 176000003 | 183987723 | Jupiter Ascending | Mila Kunis|Channing Tatum|Sean Bean|Eddie Redm... | Lana Wachowski|Lilly Wachowski | In a universe where human genetic material is ... | 124 | Science Fiction|Fantasy|Action|Adventure | Village Roadshow Pictures|Dune Entertainment|A... | 2/4/15 | 1937 | 5.2 | 2015 | 1.619199e+08 | 1.692686e+08 |
264660 | tt0470752 | 6.118847 | 15000000 | 36869414 | Ex Machina | Domhnall Gleeson|Alicia Vikander|Oscar Isaac|S... | Alex Garland | Caleb, a 26 year old coder at the world's larg... | 108 | Drama|Science Fiction | DNA Films|Universal Pictures International (UP... | 1/21/15 | 2854 | 7.6 | 2015 | 1.379999e+07 | 3.391985e+07 |
257344 | tt2120120 | 5.984995 | 88000000 | 243637091 | Pixels | Adam Sandler|Michelle Monaghan|Peter Dinklage|... | Chris Columbus | Video game experts are recruited by the milita... | 105 | Action|Comedy|Science Fiction | Columbia Pictures|Happy Madison Productions | 7/16/15 | 1575 | 5.8 | 2015 | 8.095996e+07 | 2.241460e+08 |
99861 | tt2395427 | 5.944927 | 280000000 | 1405035767 | Avengers: Age of Ultron | Robert Downey Jr.|Chris Hemsworth|Mark Ruffalo... | Joss Whedon | When Tony Stark tries to jumpstart a dormant p... | 141 | Action|Adventure|Science Fiction | Marvel Studios|Prime Focus|Revolution Sun Studios | 4/22/15 | 4304 | 7.4 | 2015 | 2.575999e+08 | 1.292632e+09 |
273248 | tt3460252 | 5.898400 | 44000000 | 155760117 | The Hateful Eight | Samuel L. Jackson|Kurt Russell|Jennifer Jason ... | Quentin Tarantino | Bounty hunters seek shelter from a raging bliz... | 167 | Crime|Drama|Mystery|Western | Double Feature Films|The Weinstein Company|Fil... | 12/25/15 | 2389 | 7.4 | 2015 | 4.047998e+07 | 1.432992e+08 |
260346 | tt2446042 | 5.749758 | 48000000 | 325771424 | Taken 3 | Liam Neeson|Forest Whitaker|Maggie Grace|Famke... | Olivier Megaton | Ex-government operative Bryan Mills finds his ... | 109 | Crime|Action|Thriller | Twentieth Century Fox Film Corporation|M6 Film... | 1/1/15 | 1578 | 6.1 | 2015 | 4.415998e+07 | 2.997096e+08 |
102899 | tt0478970 | 5.573184 | 130000000 | 518602163 | Ant-Man | Paul Rudd|Michael Douglas|Evangeline Lilly|Cor... | Peyton Reed | Armed with the astonishing ability to shrink i... | 115 | Science Fiction|Action|Adventure | Marvel Studios | 7/14/15 | 3779 | 7.0 | 2015 | 1.195999e+08 | 4.771138e+08 |
150689 | tt1661199 | 5.556818 | 95000000 | 542351353 | Cinderella | Lily James|Cate Blanchett|Richard Madden|Helen... | Kenneth Branagh | When her father unexpectedly passes away, youn... | 112 | Romance|Fantasy|Family|Drama | Walt Disney Pictures|Genre Films|Beagle Pug Fi... | 3/12/15 | 1495 | 6.8 | 2015 | 8.739996e+07 | 4.989630e+08 |
131634 | tt1951266 | 5.476958 | 160000000 | 650523427 | The Hunger Games: Mockingjay - Part 2 | Jennifer Lawrence|Josh Hutcherson|Liam Hemswor... | Francis Lawrence | With the nation of Panem in a full scale war, ... | 136 | War|Adventure|Science Fiction | Studio Babelsberg|StudioCanal|Lionsgate|Walt D... | 11/18/15 | 2380 | 6.5 | 2015 | 1.471999e+08 | 5.984813e+08 |
158852 | tt1964418 | 5.462138 | 190000000 | 209035668 | Tomorrowland | Britt Robertson|George Clooney|Raffey Cassidy|... | Brad Bird | Bound by a shared destiny, a bright, optimisti... | 130 | Action|Family|Science Fiction|Adventure|Mystery | Walt Disney Pictures|Babieka|A113 | 5/19/15 | 1899 | 6.2 | 2015 | 1.747999e+08 | 1.923127e+08 |
307081 | tt1798684 | 5.337064 | 30000000 | 91709827 | Southpaw | Jake Gyllenhaal|Rachel McAdams|Forest Whitaker... | Antoine Fuqua | Billy "The Great" Hope, the reigning junior mi... | 123 | Action|Drama | Escape Artists|Riche-Ludwig Productions | 6/15/15 | 1386 | 7.3 | 2015 | 2.759999e+07 | 8.437300e+07 |
157336 | tt0816692 | 24.949134 | 165000000 | 621752480 | Interstellar | Matthew McConaughey|Jessica Chastain|Anne Hath... | Christopher Nolan | Interstellar chronicles the adventures of a gr... | 169 | Adventure|Drama|Science Fiction | Paramount Pictures|Legendary Pictures|Warner B... | 11/5/14 | 6498 | 8.0 | 2014 | 1.519800e+08 | 5.726906e+08 |
118340 | tt2015381 | 14.311205 | 170000000 | 773312399 | Guardians of the Galaxy | Chris Pratt|Zoe Saldana|Dave Bautista|Vin Dies... | James Gunn | Light years from Earth, 26 years after being a... | 121 | Action|Science Fiction|Adventure | Marvel Studios|Moving Picture Company (MPC)|Bu... | 7/30/14 | 5612 | 7.9 | 2014 | 1.565855e+08 | 7.122911e+08 |
100402 | tt1843866 | 12.971027 | 170000000 | 714766572 | Captain America: The Winter Soldier | Chris Evans|Scarlett Johansson|Sebastian Stan|... | Joe Russo|Anthony Russo | After the cataclysmic events in New York with ... | 136 | Action|Adventure|Science Fiction | Marvel Studios | 3/20/14 | 3848 | 7.6 | 2014 | 1.565855e+08 | 6.583651e+08 |
245891 | tt2911666 | 11.422751 | 20000000 | 78739897 | John Wick | Keanu Reeves|Michael Nyqvist|Alfie Allen|Wille... | Chad Stahelski|David Leitch | After the sudden death of his beloved wife, Jo... | 101 | Action|Thriller | Thunder Road Pictures|Warner Bros.|87Eleven|De... | 10/22/14 | 2712 | 7.0 | 2014 | 1.842182e+07 | 7.252661e+07 |
131631 | tt1951265 | 10.739009 | 125000000 | 752100229 | The Hunger Games: Mockingjay - Part 1 | Jennifer Lawrence|Josh Hutcherson|Liam Hemswor... | Francis Lawrence | Katniss Everdeen reluctantly becomes the symbo... | 123 | Science Fiction|Adventure|Thriller | Lionsgate|Color Force | 11/18/14 | 3590 | 6.6 | 2014 | 1.151364e+08 | 6.927528e+08 |
122917 | tt2310332 | 10.174599 | 250000000 | 955119788 | The Hobbit: The Battle of the Five Armies | Martin Freeman|Ian McKellen|Richard Armitage|K... | Peter Jackson | Immediately after the events of The Desolation... | 144 | Adventure|Fantasy | WingNut Films|New Line Cinema|3Foot7|Metro-Gol... | 12/10/14 | 3110 | 7.1 | 2014 | 2.302728e+08 | 8.797523e+08 |
177572 | tt2245084 | 8.691294 | 165000000 | 652105443 | Big Hero 6 | Scott Adsit|Ryan Potter|Daniel Henney|T.J. Mil... | Don Hall|Chris Williams | The special bond that develops between plus-si... | 102 | Adventure|Family|Animation|Action|Comedy | Walt Disney Pictures|Walt Disney Animation Stu... | 10/24/14 | 4185 | 7.8 | 2014 | 1.519800e+08 | 6.006485e+08 |
205596 | tt2084970 | 8.110711 | 14000000 | 233555708 | The Imitation Game | Benedict Cumberbatch|Keira Knightley|Matthew G... | Morten Tyldum | Based on the real life story of legendary cryp... | 113 | History|Drama|Thriller|War | Black Bear Pictures|Bristol Automotive | 11/14/14 | 3478 | 8.0 | 2014 | 1.289527e+07 | 2.151261e+08 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
10681 | tt0910970 | 5.678119 | 180000000 | 521311860 | WALL·E | Ben Burtt|Elissa Knight|Jeff Garlin|Fred Willa... | Andrew Stanton | WALL·E is the last robot left on an Earth tha... | 98 | Animation|Family | Walt Disney Pictures|Pixar Animation Studios | 6/22/08 | 4209 | 7.6 | 2008 | 1.823016e+08 | 5.279777e+08 |
161337 | tt2381375 | 8.411577 | 0 | 0 | Underworld: Endless War | Trevor Devall|Brian Dobson|Paul Dobson|Laura H... | Juno John Lee | Underworld: Endless War is a collection of thr... | 18 | Action|Animation|Horror | 无 | 10/19/11 | 21 | 5.9 | 2011 | 0.000000e+00 | 0.000000e+00 |
1771 | tt0458339 | 7.959228 | 140000000 | 370569774 | Captain America: The First Avenger | Chris Evans|Hugo Weaving|Tommy Lee Jones|Hayle... | Joe Johnston | Predominantly set during World War II, Steve R... | 124 | Action|Adventure|Science Fiction | Marvel Studios | 7/22/11 | 5025 | 6.5 | 2011 | 1.357157e+08 | 3.592296e+08 |
64690 | tt0780504 | 5.903353 | 15000000 | 76175166 | Drive | Ryan Gosling|Carey Mulligan|Christina Hendrick... | Nicolas Winding Refn | A mysterious Hollywood stuntman who moonlights... | 100 | Drama|Action|Thriller|Crime | Bold Films|Marc Platt Productions|Odd Lot Ente... | 1/10/11 | 2347 | 7.3 | 2011 | 1.454097e+07 | 7.384406e+07 |
12445 | tt1201607 | 5.711315 | 125000000 | 1327817822 | Harry Potter and the Deathly Hallows: Part 2 | Daniel Radcliffe|Rupert Grint|Emma Watson|Alan... | David Yates | Harry, Ron and Hermione continue their quest t... | 130 | Adventure|Family|Fantasy | Warner Bros.|Heyday Films|Moving Picture Compa... | 7/7/11 | 3750 | 7.7 | 2011 | 1.211748e+08 | 1.287184e+09 |
121 | tt0167261 | 8.095275 | 79000000 | 926287400 | The Lord of the Rings: The Two Towers | Elijah Wood|Ian McKellen|Viggo Mortensen|Liv T... | Peter Jackson | Frodo and Sam are trekking to Mordor to destro... | 179 | Adventure|Fantasy|Action | WingNut Films|New Line Cinema|The Saul Zaentz ... | 12/18/02 | 5114 | 7.8 | 2002 | 9.576865e+07 | 1.122902e+09 |
672 | tt0295297 | 6.012584 | 100000000 | 876688482 | Harry Potter and the Chamber of Secrets | Daniel Radcliffe|Rupert Grint|Emma Watson|Kenn... | Chris Columbus | Ignoring threats to his life, Harry returns to... | 161 | Adventure|Fantasy|Family | 1492 Pictures|Warner Bros.|Heyday Films|MIRACL... | 11/13/02 | 3458 | 7.2 | 2002 | 1.212261e+08 | 1.062776e+09 |
680 | tt0110912 | 8.093754 | 8000000 | 213928762 | Pulp Fiction | John Travolta|Samuel L. Jackson|Uma Thurman|Br... | Quentin Tarantino | A burger-loving hit man, his philosophical par... | 154 | Thriller|Crime | Miramax Films|A Band Apart|Jersey Films | 10/14/94 | 5343 | 8.1 | 1994 | 1.176889e+07 | 3.147131e+08 |
278 | tt0111161 | 7.192039 | 25000000 | 28341469 | The Shawshank Redemption | Tim Robbins|Morgan Freeman|Bob Gunton|William ... | Frank Darabont | Framed in the 1940s for the double murder of h... | 142 | Drama|Crime | Castle Rock Entertainment | 9/10/94 | 5754 | 8.4 | 1994 | 3.677779e+07 | 4.169346e+07 |
13 | tt0109830 | 6.715966 | 55000000 | 677945399 | Forrest Gump | Tom Hanks|Robin Wright|Gary Sinise|Mykelti Wil... | Robert Zemeckis | A man with a low IQ has accomplished great thi... | 142 | Comedy|Drama|Romance | Paramount Pictures | 7/6/94 | 4856 | 8.1 | 1994 | 8.091114e+07 | 9.973333e+08 |
24428 | tt0848228 | 7.637767 | 220000000 | 1519557910 | The Avengers | Robert Downey Jr.|Chris Evans|Mark Ruffalo|Chr... | Joss Whedon | When an unexpected enemy emerges and threatens... | 143 | Science Fiction|Action|Adventure | Marvel Studios | 4/25/12 | 8903 | 7.3 | 2012 | 2.089437e+08 | 1.443191e+09 |
52520 | tt1496025 | 7.031452 | 70000000 | 132400000 | Underworld: Awakening | Kate Beckinsale|Stephen Rea|Michael Ealy|Theo ... | Måns Mårlind|Björn Stein | After being held in a coma-like state for fift... | 88 | Fantasy|Action|Horror | Lakeshore Entertainment|Saturn Films|Screen Ge... | 1/19/12 | 1426 | 6.0 | 2012 | 6.648210e+07 | 1.257461e+08 |
49026 | tt1345836 | 6.591277 | 250000000 | 1081041287 | The Dark Knight Rises | Christian Bale|Michael Caine|Gary Oldman|Anne ... | Christopher Nolan | Following the death of District Attorney Harve... | 165 | Action|Crime|Drama|Thriller | Legendary Pictures|Warner Bros.|DC Entertainme... | 7/16/12 | 6723 | 7.5 | 2012 | 2.374361e+08 | 1.026713e+09 |
68718 | tt1853728 | 5.944518 | 100000000 | 425368238 | Django Unchained | Jamie Foxx|Christoph Waltz|Leonardo DiCaprio|K... | Quentin Tarantino | With the help of a German bounty hunter, a fre... | 165 | Drama|Western | Columbia Pictures|The Weinstein Company | 12/25/12 | 7375 | 7.7 | 2012 | 9.497443e+07 | 4.039911e+08 |
37724 | tt1074638 | 5.603587 | 200000000 | 1108561013 | Skyfall | Daniel Craig|Judi Dench|Javier Bardem|Ralph Fi... | Sam Mendes | When Bond's latest assignment goes gravely wro... | 143 | Action|Adventure|Thriller | Columbia Pictures | 10/25/12 | 6137 | 6.8 | 2012 | 1.899489e+08 | 1.052849e+09 |
122 | tt0167260 | 7.122455 | 94000000 | 1118888979 | The Lord of the Rings: The Return of the King | Elijah Wood|Ian McKellen|Viggo Mortensen|Liv T... | Peter Jackson | Aragorn is revealed as the heir to the ancient... | 201 | Adventure|Fantasy|Action | WingNut Films|New Line Cinema | 12/1/03 | 5636 | 7.9 | 2003 | 1.114231e+08 | 1.326278e+09 |
277 | tt0320691 | 6.887883 | 22000000 | 95708457 | Underworld | Kate Beckinsale|Scott Speedman|Michael Sheen|S... | Len Wiseman | Vampires and werewolves have waged a nocturnal... | 121 | Fantasy|Action|Thriller | Lakeshore Entertainment|Laurinfilm|Subterranea... | 9/19/03 | 1708 | 6.5 | 2003 | 2.607776e+07 | 1.134483e+08 |
22 | tt0325980 | 6.864067 | 140000000 | 655011224 | Pirates of the Caribbean: The Curse of the Bla... | Johnny Depp|Geoffrey Rush|Orlando Bloom|Keira ... | Gore Verbinski | Jack Sparrow, a freewheeling 17th-century pira... | 143 | Adventure|Fantasy|Action | Walt Disney Pictures|Jerry Bruckheimer Films | 7/9/03 | 4223 | 7.3 | 2003 | 1.659494e+08 | 7.764193e+08 |
24 | tt0266697 | 6.174132 | 30000000 | 180949000 | Kill Bill: Vol. 1 | Uma Thurman|Lucy Liu|Vivica A. Fox|Daryl Hanna... | Quentin Tarantino | An assassin is shot at the altar by her ruthle... | 111 | Action|Crime | Miramax Films|A Band Apart|Super Cool ManChu | 10/10/03 | 2932 | 7.6 | 2003 | 3.556058e+07 | 2.144884e+08 |
13590 | tt0195753 | 6.668990 | 0 | 0 | Eddie Izzard: Glorious | Eddie Izzard|Mac McDonald|Rhona Mitra | Peter Richardson | Eddie Izzard's routine has a loose trajectory ... | 99 | Comedy | 无 | 11/17/97 | 11 | 5.5 | 1997 | 0.000000e+00 | 0.000000e+00 |
109445 | tt2294629 | 6.112766 | 150000000 | 1274219009 | Frozen | Kristen Bell|Idina Menzel|Jonathan Groff|Josh ... | Chris Buck|Jennifer Lee | Young princess Anna of Arendelle dreams about ... | 102 | Animation|Adventure|Family | Walt Disney Pictures|Walt Disney Animation Stu... | 11/27/13 | 3369 | 7.5 | 2013 | 1.404050e+08 | 1.192711e+09 |
49047 | tt1454468 | 5.242753 | 105000000 | 716392705 | Gravity | Sandra Bullock|George Clooney|Ed Harris|Orto I... | Alfonso Cuarón | Dr. Ryan Stone (Sandra Bullock), a brilliant m... | 91 | Science Fiction|Thriller|Drama | Warner Bros.|Heyday Films|Esperanto Filmoj | 9/27/13 | 3775 | 7.4 | 2013 | 9.828350e+07 | 6.705675e+08 |
76338 | tt1981115 | 5.111900 | 170000000 | 479765000 | Thor: The Dark World | Chris Hemsworth|Natalie Portman|Tom Hiddleston... | Alan Taylor | Thor fights to restore order across the cosmos... | 112 | Action|Adventure|Fantasy | Marvel Studios | 10/29/13 | 3025 | 6.8 | 2013 | 1.591257e+08 | 4.490760e+08 |
105 | tt0088763 | 6.095293 | 19000000 | 381109762 | Back to the Future | Michael J. Fox|Christopher Lloyd|Lea Thompson|... | Robert Zemeckis | Eighties teenager Marty McFly is accidentally ... | 116 | Adventure|Comedy|Science Fiction|Family | Universal Pictures|Amblin Entertainment|U-Driv... | 7/3/85 | 3785 | 7.8 | 1985 | 3.851615e+07 | 7.725728e+08 |
674 | tt0330373 | 5.939927 | 150000000 | 895921036 | Harry Potter and the Goblet of Fire | Daniel Radcliffe|Rupert Grint|Emma Watson|Ralp... | Mike Newell | Harry starts his fourth year at Hogwarts, comp... | 157 | Adventure|Fantasy|Family | Patalex IV Productions Limited|Warner Bros.|He... | 11/5/05 | 3406 | 7.3 | 2005 | 1.674845e+08 | 1.000353e+09 |
272 | tt0372784 | 5.400826 | 150000000 | 374218673 | Batman Begins | Christian Bale|Michael Caine|Liam Neeson|Katie... | Christopher Nolan | Driven by tragedy, billionaire Bruce Wayne ded... | 140 | Action|Crime|Drama | DC Comics|Legendary Pictures|Warner Bros.|DC E... | 6/14/05 | 4914 | 7.3 | 2005 | 1.674845e+08 | 4.178388e+08 |
834 | tt0401855 | 5.838503 | 50000000 | 111340801 | Underworld: Evolution | Kate Beckinsale|Scott Speedman|Tony Curran|Sha... | Len Wiseman | As the war between the vampires and the Lycans... | 106 | Fantasy|Action|Science Fiction|Thriller | Lakeshore Entertainment|Screen Gems | 1/12/06 | 1015 | 6.3 | 2006 | 5.408346e+07 | 1.204339e+08 |
673 | tt0304141 | 5.827781 | 130000000 | 789804554 | Harry Potter and the Prisoner of Azkaban | Daniel Radcliffe|Rupert Grint|Emma Watson|Gary... | Alfonso Cuarón | Harry, Ron and Hermione return to Hogwarts for... | 141 | Adventure|Fantasy|Family | 1492 Pictures|Warner Bros.|Heyday Films|P of A... | 5/31/04 | 3550 | 7.4 | 2004 | 1.500779e+08 | 9.117862e+08 |
238 | tt0068646 | 5.738034 | 6000000 | 245066411 | The Godfather | Marlon Brando|Al Pacino|James Caan|Richard S. ... | Francis Ford Coppola | Spanning the years 1945 to 1955, a chronicle o... | 175 | Drama|Crime | Paramount Pictures|Alfran Productions | 3/15/72 | 3970 | 8.3 | 1972 | 3.128737e+07 | 1.277914e+09 |
1891 | tt0080684 | 5.488441 | 18000000 | 538400000 | The Empire Strikes Back | Mark Hamill|Harrison Ford|Carrie Fisher|Billy ... | Irvin Kershner | The epic saga continues as Luke Skywalker, in ... | 124 | Adventure|Action|Science Fiction | Lucasfilm|Twentieth Century Fox Film Corporation | 1/1/80 | 3954 | 8.0 | 1980 | 4.762866e+07 | 1.424626e+09 |
85 rows × 17 columns
#读取数据表中 popularity 大于5 的所有数据且发行年份在1996年之后的所有数据。
movie_data[(movie_data['popularity'] > 5) & (movie_data['release_year'] > 1996)]
imdb_id | popularity | budget | revenue | original_title | cast | director | overview | runtime | genres | production_companies | release_date | vote_count | vote_average | release_year | budget_adj | revenue_adj | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
id | |||||||||||||||||
135397 | tt0369610 | 32.985763 | 150000000 | 1513528810 | Jurassic World | Chris Pratt|Bryce Dallas Howard|Irrfan Khan|Vi... | Colin Trevorrow | Twenty-two years after the events of Jurassic ... | 124 | Action|Adventure|Science Fiction|Thriller | Universal Studios|Amblin Entertainment|Legenda... | 6/9/15 | 5562 | 6.5 | 2015 | 1.379999e+08 | 1.392446e+09 |
76341 | tt1392190 | 28.419936 | 150000000 | 378436354 | Mad Max: Fury Road | Tom Hardy|Charlize Theron|Hugh Keays-Byrne|Nic... | George Miller | An apocalyptic story set in the furthest reach... | 120 | Action|Adventure|Science Fiction|Thriller | Village Roadshow Pictures|Kennedy Miller Produ... | 5/13/15 | 6185 | 7.1 | 2015 | 1.379999e+08 | 3.481613e+08 |
262500 | tt2908446 | 13.112507 | 110000000 | 295238201 | Insurgent | Shailene Woodley|Theo James|Kate Winslet|Ansel... | Robert Schwentke | Beatrice Prior must confront her inner demons ... | 119 | Adventure|Science Fiction|Thriller | Summit Entertainment|Mandeville Films|Red Wago... | 3/18/15 | 2480 | 6.3 | 2015 | 1.012000e+08 | 2.716190e+08 |
140607 | tt2488496 | 11.173104 | 200000000 | 2068178225 | Star Wars: The Force Awakens | Harrison Ford|Mark Hamill|Carrie Fisher|Adam D... | J.J. Abrams | Thirty years after defeating the Galactic Empi... | 136 | Action|Adventure|Science Fiction|Fantasy | Lucasfilm|Truenorth Productions|Bad Robot | 12/15/15 | 5292 | 7.5 | 2015 | 1.839999e+08 | 1.902723e+09 |
168259 | tt2820852 | 9.335014 | 190000000 | 1506249360 | Furious 7 | Vin Diesel|Paul Walker|Jason Statham|Michelle ... | James Wan | Deckard Shaw seeks revenge against Dominic Tor... | 137 | Action|Crime|Thriller | Universal Pictures|Original Film|Media Rights ... | 4/1/15 | 2947 | 7.3 | 2015 | 1.747999e+08 | 1.385749e+09 |
281957 | tt1663202 | 9.110700 | 135000000 | 532950503 | The Revenant | Leonardo DiCaprio|Tom Hardy|Will Poulter|Domhn... | Alejandro González Iñárritu | In the 1820s, a frontiersman, Hugh Glass, sets... | 156 | Western|Drama|Adventure|Thriller | Regency Enterprises|Appian Way|CatchPlay|Anony... | 12/25/15 | 3929 | 7.2 | 2015 | 1.241999e+08 | 4.903142e+08 |
87101 | tt1340138 | 8.654359 | 155000000 | 440603537 | Terminator Genisys | Arnold Schwarzenegger|Jason Clarke|Emilia Clar... | Alan Taylor | The year is 2029. John Connor, leader of the r... | 125 | Science Fiction|Action|Thriller|Adventure | Paramount Pictures|Skydance Productions | 6/23/15 | 2598 | 5.8 | 2015 | 1.425999e+08 | 4.053551e+08 |
286217 | tt3659388 | 7.667400 | 108000000 | 595380321 | The Martian | Matt Damon|Jessica Chastain|Kristen Wiig|Jeff ... | Ridley Scott | During a manned mission to Mars, Astronaut Mar... | 141 | Drama|Adventure|Science Fiction | Twentieth Century Fox Film Corporation|Scott F... | 9/30/15 | 4572 | 7.6 | 2015 | 9.935996e+07 | 5.477497e+08 |
211672 | tt2293640 | 7.404165 | 74000000 | 1156730962 | Minions | Sandra Bullock|Jon Hamm|Michael Keaton|Allison... | Kyle Balda|Pierre Coffin | Minions Stuart, Kevin and Bob are recruited by... | 91 | Family|Animation|Adventure|Comedy | Universal Pictures|Illumination Entertainment | 6/17/15 | 2893 | 6.5 | 2015 | 6.807997e+07 | 1.064192e+09 |
150540 | tt2096673 | 6.326804 | 175000000 | 853708609 | Inside Out | Amy Poehler|Phyllis Smith|Richard Kind|Bill Ha... | Pete Docter | Growing up can be a bumpy road, and it's no ex... | 94 | Comedy|Animation|Family | Walt Disney Pictures|Pixar Animation Studios|W... | 6/9/15 | 3935 | 8.0 | 2015 | 1.609999e+08 | 7.854116e+08 |
206647 | tt2379713 | 6.200282 | 245000000 | 880674609 | Spectre | Daniel Craig|Christoph Waltz|Léa Seydoux|Ralp... | Sam Mendes | A cryptic message from Bond’s past sends him... | 148 | Action|Adventure|Crime | Columbia Pictures|Danjaq|B24 | 10/26/15 | 3254 | 6.2 | 2015 | 2.253999e+08 | 8.102203e+08 |
76757 | tt1617661 | 6.189369 | 176000003 | 183987723 | Jupiter Ascending | Mila Kunis|Channing Tatum|Sean Bean|Eddie Redm... | Lana Wachowski|Lilly Wachowski | In a universe where human genetic material is ... | 124 | Science Fiction|Fantasy|Action|Adventure | Village Roadshow Pictures|Dune Entertainment|A... | 2/4/15 | 1937 | 5.2 | 2015 | 1.619199e+08 | 1.692686e+08 |
264660 | tt0470752 | 6.118847 | 15000000 | 36869414 | Ex Machina | Domhnall Gleeson|Alicia Vikander|Oscar Isaac|S... | Alex Garland | Caleb, a 26 year old coder at the world's larg... | 108 | Drama|Science Fiction | DNA Films|Universal Pictures International (UP... | 1/21/15 | 2854 | 7.6 | 2015 | 1.379999e+07 | 3.391985e+07 |
257344 | tt2120120 | 5.984995 | 88000000 | 243637091 | Pixels | Adam Sandler|Michelle Monaghan|Peter Dinklage|... | Chris Columbus | Video game experts are recruited by the milita... | 105 | Action|Comedy|Science Fiction | Columbia Pictures|Happy Madison Productions | 7/16/15 | 1575 | 5.8 | 2015 | 8.095996e+07 | 2.241460e+08 |
99861 | tt2395427 | 5.944927 | 280000000 | 1405035767 | Avengers: Age of Ultron | Robert Downey Jr.|Chris Hemsworth|Mark Ruffalo... | Joss Whedon | When Tony Stark tries to jumpstart a dormant p... | 141 | Action|Adventure|Science Fiction | Marvel Studios|Prime Focus|Revolution Sun Studios | 4/22/15 | 4304 | 7.4 | 2015 | 2.575999e+08 | 1.292632e+09 |
273248 | tt3460252 | 5.898400 | 44000000 | 155760117 | The Hateful Eight | Samuel L. Jackson|Kurt Russell|Jennifer Jason ... | Quentin Tarantino | Bounty hunters seek shelter from a raging bliz... | 167 | Crime|Drama|Mystery|Western | Double Feature Films|The Weinstein Company|Fil... | 12/25/15 | 2389 | 7.4 | 2015 | 4.047998e+07 | 1.432992e+08 |
260346 | tt2446042 | 5.749758 | 48000000 | 325771424 | Taken 3 | Liam Neeson|Forest Whitaker|Maggie Grace|Famke... | Olivier Megaton | Ex-government operative Bryan Mills finds his ... | 109 | Crime|Action|Thriller | Twentieth Century Fox Film Corporation|M6 Film... | 1/1/15 | 1578 | 6.1 | 2015 | 4.415998e+07 | 2.997096e+08 |
102899 | tt0478970 | 5.573184 | 130000000 | 518602163 | Ant-Man | Paul Rudd|Michael Douglas|Evangeline Lilly|Cor... | Peyton Reed | Armed with the astonishing ability to shrink i... | 115 | Science Fiction|Action|Adventure | Marvel Studios | 7/14/15 | 3779 | 7.0 | 2015 | 1.195999e+08 | 4.771138e+08 |
150689 | tt1661199 | 5.556818 | 95000000 | 542351353 | Cinderella | Lily James|Cate Blanchett|Richard Madden|Helen... | Kenneth Branagh | When her father unexpectedly passes away, youn... | 112 | Romance|Fantasy|Family|Drama | Walt Disney Pictures|Genre Films|Beagle Pug Fi... | 3/12/15 | 1495 | 6.8 | 2015 | 8.739996e+07 | 4.989630e+08 |
131634 | tt1951266 | 5.476958 | 160000000 | 650523427 | The Hunger Games: Mockingjay - Part 2 | Jennifer Lawrence|Josh Hutcherson|Liam Hemswor... | Francis Lawrence | With the nation of Panem in a full scale war, ... | 136 | War|Adventure|Science Fiction | Studio Babelsberg|StudioCanal|Lionsgate|Walt D... | 11/18/15 | 2380 | 6.5 | 2015 | 1.471999e+08 | 5.984813e+08 |
158852 | tt1964418 | 5.462138 | 190000000 | 209035668 | Tomorrowland | Britt Robertson|George Clooney|Raffey Cassidy|... | Brad Bird | Bound by a shared destiny, a bright, optimisti... | 130 | Action|Family|Science Fiction|Adventure|Mystery | Walt Disney Pictures|Babieka|A113 | 5/19/15 | 1899 | 6.2 | 2015 | 1.747999e+08 | 1.923127e+08 |
307081 | tt1798684 | 5.337064 | 30000000 | 91709827 | Southpaw | Jake Gyllenhaal|Rachel McAdams|Forest Whitaker... | Antoine Fuqua | Billy "The Great" Hope, the reigning junior mi... | 123 | Action|Drama | Escape Artists|Riche-Ludwig Productions | 6/15/15 | 1386 | 7.3 | 2015 | 2.759999e+07 | 8.437300e+07 |
157336 | tt0816692 | 24.949134 | 165000000 | 621752480 | Interstellar | Matthew McConaughey|Jessica Chastain|Anne Hath... | Christopher Nolan | Interstellar chronicles the adventures of a gr... | 169 | Adventure|Drama|Science Fiction | Paramount Pictures|Legendary Pictures|Warner B... | 11/5/14 | 6498 | 8.0 | 2014 | 1.519800e+08 | 5.726906e+08 |
118340 | tt2015381 | 14.311205 | 170000000 | 773312399 | Guardians of the Galaxy | Chris Pratt|Zoe Saldana|Dave Bautista|Vin Dies... | James Gunn | Light years from Earth, 26 years after being a... | 121 | Action|Science Fiction|Adventure | Marvel Studios|Moving Picture Company (MPC)|Bu... | 7/30/14 | 5612 | 7.9 | 2014 | 1.565855e+08 | 7.122911e+08 |
100402 | tt1843866 | 12.971027 | 170000000 | 714766572 | Captain America: The Winter Soldier | Chris Evans|Scarlett Johansson|Sebastian Stan|... | Joe Russo|Anthony Russo | After the cataclysmic events in New York with ... | 136 | Action|Adventure|Science Fiction | Marvel Studios | 3/20/14 | 3848 | 7.6 | 2014 | 1.565855e+08 | 6.583651e+08 |
245891 | tt2911666 | 11.422751 | 20000000 | 78739897 | John Wick | Keanu Reeves|Michael Nyqvist|Alfie Allen|Wille... | Chad Stahelski|David Leitch | After the sudden death of his beloved wife, Jo... | 101 | Action|Thriller | Thunder Road Pictures|Warner Bros.|87Eleven|De... | 10/22/14 | 2712 | 7.0 | 2014 | 1.842182e+07 | 7.252661e+07 |
131631 | tt1951265 | 10.739009 | 125000000 | 752100229 | The Hunger Games: Mockingjay - Part 1 | Jennifer Lawrence|Josh Hutcherson|Liam Hemswor... | Francis Lawrence | Katniss Everdeen reluctantly becomes the symbo... | 123 | Science Fiction|Adventure|Thriller | Lionsgate|Color Force | 11/18/14 | 3590 | 6.6 | 2014 | 1.151364e+08 | 6.927528e+08 |
122917 | tt2310332 | 10.174599 | 250000000 | 955119788 | The Hobbit: The Battle of the Five Armies | Martin Freeman|Ian McKellen|Richard Armitage|K... | Peter Jackson | Immediately after the events of The Desolation... | 144 | Adventure|Fantasy | WingNut Films|New Line Cinema|3Foot7|Metro-Gol... | 12/10/14 | 3110 | 7.1 | 2014 | 2.302728e+08 | 8.797523e+08 |
177572 | tt2245084 | 8.691294 | 165000000 | 652105443 | Big Hero 6 | Scott Adsit|Ryan Potter|Daniel Henney|T.J. Mil... | Don Hall|Chris Williams | The special bond that develops between plus-si... | 102 | Adventure|Family|Animation|Action|Comedy | Walt Disney Pictures|Walt Disney Animation Stu... | 10/24/14 | 4185 | 7.8 | 2014 | 1.519800e+08 | 6.006485e+08 |
205596 | tt2084970 | 8.110711 | 14000000 | 233555708 | The Imitation Game | Benedict Cumberbatch|Keira Knightley|Matthew G... | Morten Tyldum | Based on the real life story of legendary cryp... | 113 | History|Drama|Thriller|War | Black Bear Pictures|Bristol Automotive | 11/14/14 | 3478 | 8.0 | 2014 | 1.289527e+07 | 2.151261e+08 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
44214 | tt0947798 | 5.293180 | 13000000 | 327803731 | Black Swan | Natalie Portman|Mila Kunis|Vincent Cassel|Barb... | Darren Aronofsky | A ballet dancer wins the lead in "Swan Lake" a... | 108 | Drama|Mystery|Thriller | Fox Searchlight Pictures|Dune Entertainment|Pr... | 12/2/10 | 2597 | 7.1 | 2010 | 1.300000e+07 | 3.278037e+08 |
550 | tt0137523 | 8.947905 | 63000000 | 100853753 | Fight Club | Edward Norton|Brad Pitt|Meat Loaf|Jared Leto|H... | David Fincher | A ticking-time-bomb insomniac and a slippery s... | 139 | Drama | Regency Enterprises|Fox 2000 Pictures|Taurus F... | 10/14/99 | 5923 | 8.1 | 1999 | 8.247033e+07 | 1.320229e+08 |
603 | tt0133093 | 7.753899 | 63000000 | 463517383 | The Matrix | Keanu Reeves|Laurence Fishburne|Carrie-Anne Mo... | Lilly Wachowski|Lana Wachowski | Set in the 22nd century, The Matrix tells the ... | 136 | Action|Science Fiction | Village Roadshow Pictures|Groucho II Film Part... | 3/30/99 | 6351 | 7.8 | 1999 | 8.247033e+07 | 6.067687e+08 |
120 | tt0120737 | 8.575419 | 93000000 | 871368364 | The Lord of the Rings: The Fellowship of the Ring | Elijah Wood|Ian McKellen|Viggo Mortensen|Liv T... | Peter Jackson | Young hobbit Frodo Baggins, after inheriting a... | 178 | Adventure|Fantasy|Action | WingNut Films|New Line Cinema|The Saul Zaentz ... | 12/18/01 | 6079 | 7.8 | 2001 | 1.145284e+08 | 1.073080e+09 |
671 | tt0241527 | 8.021423 | 125000000 | 976475550 | Harry Potter and the Philosopher's Stone | Daniel Radcliffe|Rupert Grint|Emma Watson|John... | Chris Columbus | Harry Potter has lived under the stairs at his... | 152 | Adventure|Fantasy|Family | 1492 Pictures|Warner Bros.|Heyday Films | 11/16/01 | 4265 | 7.2 | 2001 | 1.539360e+08 | 1.202518e+09 |
155 | tt0468569 | 8.466668 | 185000000 | 1001921825 | The Dark Knight | Christian Bale|Michael Caine|Heath Ledger|Aaro... | Christopher Nolan | Batman raises the stakes in his war on crime. ... | 152 | Drama|Action|Crime|Thriller | DC Comics|Legendary Pictures|Warner Bros.|Syncopy | 7/16/08 | 8432 | 8.1 | 2008 | 1.873655e+08 | 1.014733e+09 |
10681 | tt0910970 | 5.678119 | 180000000 | 521311860 | WALL·E | Ben Burtt|Elissa Knight|Jeff Garlin|Fred Willa... | Andrew Stanton | WALL·E is the last robot left on an Earth tha... | 98 | Animation|Family | Walt Disney Pictures|Pixar Animation Studios | 6/22/08 | 4209 | 7.6 | 2008 | 1.823016e+08 | 5.279777e+08 |
161337 | tt2381375 | 8.411577 | 0 | 0 | Underworld: Endless War | Trevor Devall|Brian Dobson|Paul Dobson|Laura H... | Juno John Lee | Underworld: Endless War is a collection of thr... | 18 | Action|Animation|Horror | 无 | 10/19/11 | 21 | 5.9 | 2011 | 0.000000e+00 | 0.000000e+00 |
1771 | tt0458339 | 7.959228 | 140000000 | 370569774 | Captain America: The First Avenger | Chris Evans|Hugo Weaving|Tommy Lee Jones|Hayle... | Joe Johnston | Predominantly set during World War II, Steve R... | 124 | Action|Adventure|Science Fiction | Marvel Studios | 7/22/11 | 5025 | 6.5 | 2011 | 1.357157e+08 | 3.592296e+08 |
64690 | tt0780504 | 5.903353 | 15000000 | 76175166 | Drive | Ryan Gosling|Carey Mulligan|Christina Hendrick... | Nicolas Winding Refn | A mysterious Hollywood stuntman who moonlights... | 100 | Drama|Action|Thriller|Crime | Bold Films|Marc Platt Productions|Odd Lot Ente... | 1/10/11 | 2347 | 7.3 | 2011 | 1.454097e+07 | 7.384406e+07 |
12445 | tt1201607 | 5.711315 | 125000000 | 1327817822 | Harry Potter and the Deathly Hallows: Part 2 | Daniel Radcliffe|Rupert Grint|Emma Watson|Alan... | David Yates | Harry, Ron and Hermione continue their quest t... | 130 | Adventure|Family|Fantasy | Warner Bros.|Heyday Films|Moving Picture Compa... | 7/7/11 | 3750 | 7.7 | 2011 | 1.211748e+08 | 1.287184e+09 |
121 | tt0167261 | 8.095275 | 79000000 | 926287400 | The Lord of the Rings: The Two Towers | Elijah Wood|Ian McKellen|Viggo Mortensen|Liv T... | Peter Jackson | Frodo and Sam are trekking to Mordor to destro... | 179 | Adventure|Fantasy|Action | WingNut Films|New Line Cinema|The Saul Zaentz ... | 12/18/02 | 5114 | 7.8 | 2002 | 9.576865e+07 | 1.122902e+09 |
672 | tt0295297 | 6.012584 | 100000000 | 876688482 | Harry Potter and the Chamber of Secrets | Daniel Radcliffe|Rupert Grint|Emma Watson|Kenn... | Chris Columbus | Ignoring threats to his life, Harry returns to... | 161 | Adventure|Fantasy|Family | 1492 Pictures|Warner Bros.|Heyday Films|MIRACL... | 11/13/02 | 3458 | 7.2 | 2002 | 1.212261e+08 | 1.062776e+09 |
24428 | tt0848228 | 7.637767 | 220000000 | 1519557910 | The Avengers | Robert Downey Jr.|Chris Evans|Mark Ruffalo|Chr... | Joss Whedon | When an unexpected enemy emerges and threatens... | 143 | Science Fiction|Action|Adventure | Marvel Studios | 4/25/12 | 8903 | 7.3 | 2012 | 2.089437e+08 | 1.443191e+09 |
52520 | tt1496025 | 7.031452 | 70000000 | 132400000 | Underworld: Awakening | Kate Beckinsale|Stephen Rea|Michael Ealy|Theo ... | Måns Mårlind|Björn Stein | After being held in a coma-like state for fift... | 88 | Fantasy|Action|Horror | Lakeshore Entertainment|Saturn Films|Screen Ge... | 1/19/12 | 1426 | 6.0 | 2012 | 6.648210e+07 | 1.257461e+08 |
49026 | tt1345836 | 6.591277 | 250000000 | 1081041287 | The Dark Knight Rises | Christian Bale|Michael Caine|Gary Oldman|Anne ... | Christopher Nolan | Following the death of District Attorney Harve... | 165 | Action|Crime|Drama|Thriller | Legendary Pictures|Warner Bros.|DC Entertainme... | 7/16/12 | 6723 | 7.5 | 2012 | 2.374361e+08 | 1.026713e+09 |
68718 | tt1853728 | 5.944518 | 100000000 | 425368238 | Django Unchained | Jamie Foxx|Christoph Waltz|Leonardo DiCaprio|K... | Quentin Tarantino | With the help of a German bounty hunter, a fre... | 165 | Drama|Western | Columbia Pictures|The Weinstein Company | 12/25/12 | 7375 | 7.7 | 2012 | 9.497443e+07 | 4.039911e+08 |
37724 | tt1074638 | 5.603587 | 200000000 | 1108561013 | Skyfall | Daniel Craig|Judi Dench|Javier Bardem|Ralph Fi... | Sam Mendes | When Bond's latest assignment goes gravely wro... | 143 | Action|Adventure|Thriller | Columbia Pictures | 10/25/12 | 6137 | 6.8 | 2012 | 1.899489e+08 | 1.052849e+09 |
122 | tt0167260 | 7.122455 | 94000000 | 1118888979 | The Lord of the Rings: The Return of the King | Elijah Wood|Ian McKellen|Viggo Mortensen|Liv T... | Peter Jackson | Aragorn is revealed as the heir to the ancient... | 201 | Adventure|Fantasy|Action | WingNut Films|New Line Cinema | 12/1/03 | 5636 | 7.9 | 2003 | 1.114231e+08 | 1.326278e+09 |
277 | tt0320691 | 6.887883 | 22000000 | 95708457 | Underworld | Kate Beckinsale|Scott Speedman|Michael Sheen|S... | Len Wiseman | Vampires and werewolves have waged a nocturnal... | 121 | Fantasy|Action|Thriller | Lakeshore Entertainment|Laurinfilm|Subterranea... | 9/19/03 | 1708 | 6.5 | 2003 | 2.607776e+07 | 1.134483e+08 |
22 | tt0325980 | 6.864067 | 140000000 | 655011224 | Pirates of the Caribbean: The Curse of the Bla... | Johnny Depp|Geoffrey Rush|Orlando Bloom|Keira ... | Gore Verbinski | Jack Sparrow, a freewheeling 17th-century pira... | 143 | Adventure|Fantasy|Action | Walt Disney Pictures|Jerry Bruckheimer Films | 7/9/03 | 4223 | 7.3 | 2003 | 1.659494e+08 | 7.764193e+08 |
24 | tt0266697 | 6.174132 | 30000000 | 180949000 | Kill Bill: Vol. 1 | Uma Thurman|Lucy Liu|Vivica A. Fox|Daryl Hanna... | Quentin Tarantino | An assassin is shot at the altar by her ruthle... | 111 | Action|Crime | Miramax Films|A Band Apart|Super Cool ManChu | 10/10/03 | 2932 | 7.6 | 2003 | 3.556058e+07 | 2.144884e+08 |
13590 | tt0195753 | 6.668990 | 0 | 0 | Eddie Izzard: Glorious | Eddie Izzard|Mac McDonald|Rhona Mitra | Peter Richardson | Eddie Izzard's routine has a loose trajectory ... | 99 | Comedy | 无 | 11/17/97 | 11 | 5.5 | 1997 | 0.000000e+00 | 0.000000e+00 |
109445 | tt2294629 | 6.112766 | 150000000 | 1274219009 | Frozen | Kristen Bell|Idina Menzel|Jonathan Groff|Josh ... | Chris Buck|Jennifer Lee | Young princess Anna of Arendelle dreams about ... | 102 | Animation|Adventure|Family | Walt Disney Pictures|Walt Disney Animation Stu... | 11/27/13 | 3369 | 7.5 | 2013 | 1.404050e+08 | 1.192711e+09 |
49047 | tt1454468 | 5.242753 | 105000000 | 716392705 | Gravity | Sandra Bullock|George Clooney|Ed Harris|Orto I... | Alfonso Cuarón | Dr. Ryan Stone (Sandra Bullock), a brilliant m... | 91 | Science Fiction|Thriller|Drama | Warner Bros.|Heyday Films|Esperanto Filmoj | 9/27/13 | 3775 | 7.4 | 2013 | 9.828350e+07 | 6.705675e+08 |
76338 | tt1981115 | 5.111900 | 170000000 | 479765000 | Thor: The Dark World | Chris Hemsworth|Natalie Portman|Tom Hiddleston... | Alan Taylor | Thor fights to restore order across the cosmos... | 112 | Action|Adventure|Fantasy | Marvel Studios | 10/29/13 | 3025 | 6.8 | 2013 | 1.591257e+08 | 4.490760e+08 |
674 | tt0330373 | 5.939927 | 150000000 | 895921036 | Harry Potter and the Goblet of Fire | Daniel Radcliffe|Rupert Grint|Emma Watson|Ralp... | Mike Newell | Harry starts his fourth year at Hogwarts, comp... | 157 | Adventure|Fantasy|Family | Patalex IV Productions Limited|Warner Bros.|He... | 11/5/05 | 3406 | 7.3 | 2005 | 1.674845e+08 | 1.000353e+09 |
272 | tt0372784 | 5.400826 | 150000000 | 374218673 | Batman Begins | Christian Bale|Michael Caine|Liam Neeson|Katie... | Christopher Nolan | Driven by tragedy, billionaire Bruce Wayne ded... | 140 | Action|Crime|Drama | DC Comics|Legendary Pictures|Warner Bros.|DC E... | 6/14/05 | 4914 | 7.3 | 2005 | 1.674845e+08 | 4.178388e+08 |
834 | tt0401855 | 5.838503 | 50000000 | 111340801 | Underworld: Evolution | Kate Beckinsale|Scott Speedman|Tony Curran|Sha... | Len Wiseman | As the war between the vampires and the Lycans... | 106 | Fantasy|Action|Science Fiction|Thriller | Lakeshore Entertainment|Screen Gems | 1/12/06 | 1015 | 6.3 | 2006 | 5.408346e+07 | 1.204339e+08 |
673 | tt0304141 | 5.827781 | 130000000 | 789804554 | Harry Potter and the Prisoner of Azkaban | Daniel Radcliffe|Rupert Grint|Emma Watson|Gary... | Alfonso Cuarón | Harry, Ron and Hermione return to Hogwarts for... | 141 | Adventure|Fantasy|Family | 1492 Pictures|Warner Bros.|Heyday Films|P of A... | 5/31/04 | 3550 | 7.4 | 2004 | 1.500779e+08 | 9.117862e+08 |
78 rows × 17 columns
**任务2.3: **分组读取
要求:使用 Groupby
命令实现。
#对 release_year 进行分组,使用 .agg 获得 revenue 的均值。
movie_data.groupby('release_year')['revenue_adj'].agg(['mean'])
mean | |
---|---|
release_year | |
1960 | 3.340991e+07 |
1961 | 7.947167e+07 |
1962 | 4.856238e+07 |
1963 | 3.924580e+07 |
1964 | 5.707603e+07 |
1965 | 9.057670e+07 |
1966 | 1.237527e+07 |
1967 | 1.205763e+08 |
1968 | 4.255388e+07 |
1969 | 4.677888e+07 |
1970 | 7.674178e+07 |
1971 | 3.964586e+07 |
1972 | 6.449502e+07 |
1973 | 1.092939e+08 |
1974 | 7.645280e+07 |
1975 | 8.817223e+07 |
1976 | 6.530237e+07 |
1977 | 1.376362e+08 |
1978 | 7.044251e+07 |
1979 | 8.880802e+07 |
1980 | 5.999930e+07 |
1981 | 5.190054e+07 |
1982 | 6.858277e+07 |
1983 | 6.314877e+07 |
1984 | 5.268644e+07 |
1985 | 5.348319e+07 |
1986 | 4.936980e+07 |
1987 | 5.315246e+07 |
1988 | 4.755396e+07 |
1989 | 6.631404e+07 |
1990 | 6.720056e+07 |
1991 | 5.665942e+07 |
1992 | 7.101953e+07 |
1993 | 5.898085e+07 |
1994 | 5.672917e+07 |
1995 | 7.487098e+07 |
1996 | 5.664106e+07 |
1997 | 7.538870e+07 |
1998 | 6.047132e+07 |
1999 | 6.636262e+07 |
2000 | 6.124336e+07 |
2001 | 6.824115e+07 |
2002 | 6.673644e+07 |
2003 | 6.385821e+07 |
2004 | 6.315163e+07 |
2005 | 5.066509e+07 |
2006 | 4.314942e+07 |
2007 | 4.682257e+07 |
2008 | 3.967774e+07 |
2009 | 4.245562e+07 |
2010 | 4.490797e+07 |
2011 | 4.253789e+07 |
2012 | 3.998072e+07 |
2013 | 3.514198e+07 |
2014 | 3.206181e+07 |
2015 | 3.920612e+07 |
#对 director 进行分组,使用 .agg 获得 popularity 的均值,从高到低排列。
movie_data.groupby('director')['popularity'].agg(['mean']).sort_values(by='mean', ascending=False)
mean | |
---|---|
director | |
Colin Trevorrow | 16.696886 |
Joe Russo|Anthony Russo | 12.971027 |
Chad Stahelski|David Leitch | 11.422751 |
Don Hall|Chris Williams | 8.691294 |
Juno John Lee | 8.411577 |
Kyle Balda|Pierre Coffin | 7.404165 |
Alan Taylor | 6.883129 |
Peter Richardson | 6.668990 |
Pete Docter | 6.326804 |
Christopher Nolan | 6.195521 |
Alex Garland | 6.118847 |
Patrick Tatopoulos | 5.806897 |
Wes Ball | 5.553082 |
Dan Gilroy | 5.522641 |
Lilly Wachowski|Lana Wachowski | 5.331930 |
James Gunn | 5.225378 |
Bob Peterson|Pete Docter | 4.908902 |
J.J. Abrams | 4.800957 |
Alejandro González Iñárritu | 4.793536 |
Roger Allers|Rob Minkoff | 4.782688 |
Damien Chazelle | 4.780419 |
Morten Tyldum | 4.485181 |
George Miller | 4.450001 |
Francis Lawrence | 4.437604 |
Len Wiseman | 4.380968 |
Quentin Tarantino | 4.187272 |
David Yates | 4.163195 |
Evan Goldberg|Seth Rogen | 3.989231 |
John Lasseter|Joe Ranft | 3.941265 |
Chris Buck|Jennifer Lee | 3.918739 |
... | ... |
Henrique Goldman | 0.004590 |
Zak Levitt | 0.004575 |
Ricki Stern|Anne Sundberg | 0.004569 |
Venus Keung Kwok-Man|Wong Jing | 0.004433 |
Shashank Khaitan | 0.004282 |
Alex Holdridge | 0.004196 |
Karen Disher|Guy Moore | 0.004010 |
Laurent Malaquais | 0.003611 |
James Erskine | 0.003504 |
Walter Carvalho|Sandra Werneck | 0.003461 |
Katie Graham|Andrew Matthews | 0.003066 |
Nicolas Castro | 0.002922 |
David Higby | 0.002838 |
Marv Newland | 0.002757 |
David Thorpe | 0.002599 |
Oliver Irving | 0.002514 |
Barbara Schroeder | 0.002460 |
Charles B. Pierce | 0.002381 |
Norman Buckley | 0.002262 |
Beth McCarthy-Miller|Rob Ashford | 0.002165 |
Amol Palekar | 0.001983 |
Sarah Burns|Ken Burns | 0.001783 |
Enrico Oldoini | 0.001567 |
Russ Malkin|David Alexanian | 0.001531 |
Stephen Cragg | 0.001423 |
Nacho G. Velilla | 0.001317 |
Jean-Xavier de Lestrade | 0.001315 |
Zana Briski|Ross Kauffman | 0.001117 |
Dibakar Banerjee | 0.001115 |
Pascal Thomas | 0.000973 |
5065 rows × 1 columns
第三节 绘图与可视化
接着你要尝试对你的数据进行图像的绘制以及可视化。这一节最重要的是,你能够选择合适的图像,对特定的可视化目标进行可视化。所谓可视化的目标,是你希望从可视化的过程中,观察到怎样的信息以及变化。例如,观察票房随着时间的变化、哪个导演最受欢迎等。
可视化的目标 | 可以使用的图像 |
---|---|
表示某一属性数据的分布 | 饼图、直方图、散点图 |
表示某一属性数据随着某一个变量变化 | 条形图、折线图、热力图 |
比较多个属性的数据之间的关系 | 散点图、小提琴图、堆积条形图、堆积折线图 |
在这个部分,你需要根据题目中问题,选择适当的可视化图像进行绘制,并进行相应的分析。对于选做题,他们具有一定的难度,你可以尝试挑战一下~
**任务3.1:**对 popularity
最高的20名电影绘制其 popularity
值。
# data = movie_data.sort_values(by='popularity', ascending=False).iloc[0:20]
# plt.figure(figsize=(20,15))
# plt.bar(data['original_title'], data['popularity'])
# plt.title('Top 20 Polularity')
# plt.xlabel('Moive Name')
# plt.xticks(rotation=90)
# plt.ylabel('Polularity',rotation=0)
movie_data.sort_values('popularity', ascending=False).head(20).\
plot(kind='barh', y='popularity', x='original_title', legend=False)
plt.xlabel('popularity')
**任务3.2:**分析电影净利润(票房-成本)随着年份变化的情况,并简单进行分析。
data = movie_data.groupby('release_year')['revenue_adj','budget_adj'].mean()
data_std = movie_data.groupby('release_year')['revenue_adj','budget_adj'].std()
plt.figure(figsize=(20,15))
plt.errorbar(data.index ,data['revenue_adj'] - data['budget_adj'], yerr=data_std['revenue_adj'] - data_std['budget_adj'],fmt='o',ecolor='r',color='b',elinewidth=2,capsize=4)
plt.title('Profit Show By Year')
plt.xlabel('Year')
plt.xticks(rotation=90)
plt.ylabel('Profit',rotation=0)
#另外一种表示方法
plt.style.use('ggplot')
_,axes = plt.subplots(2, 1, figsize = (10,10))
movie_data['profit'] = movie_data['revenue'] - movie_data['budget']
target_data = movie_data.groupby('release_year')['profit'].agg(['sum', 'mean'])
axes[0].errorbar(target_data.index, target_data['mean']);
axes[1].errorbar(target_data.index, target_data['sum']);
axes[0].set_ylabel('profit mean')
axes[1].set_xlabel('year')
axes[1].set_ylabel('profit sum')
**[选做]任务3.3:**选择最多产的10位导演(电影数量最多的),绘制他们排行前3的三部电影的票房情况,并简要进行分析。
def func_top3(df):
return df['revenue_adj'].sort_values(ascending=False).iloc[0:3].sum()
df = movie_data[movie_data['director'] != '无']
top10directors = df.director.value_counts()[:10]
print('最多产的 10 位导演是:')
print(top10directors)
# 最多产的 10 位导演的全部电影
df = df.loc[df.director.isin(top10directors.keys())]
# print(df.shape)
# 最多产的 10 位导演每人票房排行前三的电影
df = df.sort_values('revenue', ascending = False).groupby('director').head(3)
# df[['director','revenue']].plot(kind='bar', stacked=True)
sns.barplot(y=df.director, x=df.revenue)
# data = movie_data.groupby('director')["imdb_id"].count().sort_values(ascending=False).iloc[0:10]
# data1 = movie_data.groupby('director').apply(func_top3)
# data = pd.concat([data, data1], axis=1, join='inner')
# data.columns = ['imdb_id','revenue']
# # data.info()
# data = data.sort_values(by='revenue', ascending=False)
# plt.figure(figsize=(20,15))
# plt.bar(data.index, data['revenue'])
# plt.title('Top 10 Director Revenue')
# plt.xlabel('Director Name')
# plt.xticks(rotation=90)
# plt.ylabel('Revenue',rotation=0)
最多产的 10 位导演是:
Woody Allen 45
Clint Eastwood 34
Martin Scorsese 29
Steven Spielberg 29
Ridley Scott 23
Ron Howard 22
Steven Soderbergh 22
Joel Schumacher 21
Brian De Palma 20
Barry Levinson 19
Name: director, dtype: int64
import seaborn as sb
#选出出产最多的导演的另一种做法
tmp = movie_data['director'].str.split('|', expand=True).stack().reset_index(level=1, drop=True).rename('director')
movie_data_split = movie_data[['original_title', 'revenue']].join(tmp)
## 用index来记录导演的排序
top10_director = pd.Series(movie_data_split['director'].value_counts()[:10].index, name='director').reset_index()
## 用inner的merge来代替筛选, 并进行二重排序
sort_data = movie_data.merge(top10_director, on='director').sort_values(['index','revenue_adj'],ascending=[True,False])
target_data = sort_data.groupby('director').head(3)
## 作图, 将导演设为颜色维度hue, 达到分别作图的效果
fig = plt.figure(figsize=(15, 6))
ax = sb.barplot(data=target_data, x='original_title', y='revenue_adj', hue='director', dodge=False, palette="Set2")
plt.xticks(rotation = 90)
plt.ylabel('Revenue')
plt.xlabel('Original Title')
**[选做]任务3.4:**分析1968年~2015年六月电影的数量的变化。
movie_data['release_date'] = (pd.to_datetime(movie_data['release_date']))
data = movie_data[(movie_data.release_year >= 1968) & (movie_data.release_year <=2015) & (movie_data['release_date'].dt.month == 6)].groupby('release_year').imdb_id.count()
plt.figure(figsize=(20,15))
plt.plot(data.index ,data)
plt.title('Movie Number By Year')
plt.xlabel('Year')
plt.xticks(rotation=90)
plt.ylabel('Number',rotation=0)
**[选做]任务3.5:**分析1968年~2015年六月电影 Comedy
和 Drama
两类电影的数量的变化。
data_comedy = movie_data[(movie_data.release_year >= 1968) & (movie_data.release_year <=2015) &(movie_data.genres.str.contains('Comedy')) & (movie_data['release_date'].dt.month == 6)].groupby('release_year').imdb_id.count()
data_drama = movie_data[(movie_data.release_year >= 1968) & (movie_data.release_year <=2015) &(movie_data.genres.str.contains('Drama')) & (movie_data['release_date'].dt.month == 6)].groupby('release_year').imdb_id.count()
plt.figure(figsize=(15,15))
l1, = plt.plot(data_comedy.index ,data_comedy,"b");
l2, = plt.plot(data_drama.index ,data_drama, "r");
plt.title('Comedy And Drama Number')
plt.xlabel('Year')
plt.xticks(rotation=90)
plt.ylabel('Number',rotation=0)
plt.legend([l1,l2],['Comedy','Drama'],loc='upper left')