用pandas分析百万电影数据

来源:互联网 发布:多邻国提醒连接网络 编辑:程序博客网 时间:2024/06/11 07:17

用pandas分析电影数据

Lift is short, use Python.

用Python做数据分析,pandas是Python数据分析的重要包,其他重要的包:numpy、matplotlib .

安装pandas(Linux, Mac, Windows皆同):

pip install pandas

电影数据来源:http://grouplens.org/datasets/movielens/

下载数据文件解压,包含如下4个文件:

  • users.dat 用户数据
  • movies.dat 电影数据
  • ratings.dat 评分数据
  • README 文件解释

查看README文件,可知源数据文件的格式:

  • users.dat (UserID::Gender::Age::Occupation::Zip-code)
  • movies.dat (MovieID::Title::Genres)
  • ratings.dat (UserID::MovieID::Rating::Timestamp)

特别解释:Occupation用户职业,Zip-code邮编, Timestamp时间戳, Genres电影类型(更多解释可以查看README文件).

文件中各每条数据的分割符是 ::


环境:

  • OS:Windows
  • Language:Python3.4
  • 编辑器:Jupyter

用pandas读取数据.

导入必要的头文件:

<code class="language-python hljs  has-numbering" style="display: block; padding: 0px; background-color: transparent; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-top-left-radius: 0px; border-top-right-radius: 0px; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px; word-wrap: normal; background-position: initial initial; background-repeat: initial initial;"><span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">import</span> matplotlib.pyplot <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">as</span> plt<span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">import</span> numpy <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">as</span> np<span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">import</span> pandas <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">as</span> pd</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li></ul>
读取数据,先定义字段名,因为源数据中无字段名,只有用’::’分割的每条数据.
<code class="language-python hljs  has-numbering" style="display: block; padding: 0px; background-color: transparent; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-top-left-radius: 0px; border-top-right-radius: 0px; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px; word-wrap: normal; background-position: initial initial; background-repeat: initial initial;">user_names = [<span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">'user_id'</span>, <span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">'gender'</span>, <span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">'age'</span>, <span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">'occupation'</span>, <span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">'zip'</span>] <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">#用户表的数据字段名</span></code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul>
读取数据,注意源文件的地址.
<code class="language-python hljs  has-numbering" style="display: block; padding: 0px; background-color: transparent; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-top-left-radius: 0px; border-top-right-radius: 0px; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px; word-wrap: normal; background-position: initial initial; background-repeat: initial initial;">users = pd.read_table(<span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">'C:\\Users\\Administrator\\Downloads\\ml-1m\\users.dat'</span>, sep=<span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">'::'</span>, header=<span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">None</span>, names=user_names)</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul>
D:\Anaconda3\lib\site-packages\ipykernel\__main__.py:1: ParserWarning: Falling back to the 'python' engine because the 'c' engine does not support regex separators; you can avoid this warning by specifying engine='python'.  if __name__ == '__main__':

上面有个警告,可以不管,即:加载数据是用的python engine 而不是 c engine.(更多请google) 
查看有多少个数据. 
前5行数据.

<code class="language-python hljs  has-numbering" style="display: block; padding: 0px; background-color: transparent; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-top-left-radius: 0px; border-top-right-radius: 0px; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px; word-wrap: normal; background-position: initial initial; background-repeat: initial initial;">print(len(users))users.head()</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li></ul>
6040
 user_idgenderageoccupationzip01F1104806712M56167007223M25155511734M4570246045M252055455

同理将movies,ratings数据读进来.

<code class="language-python hljs  has-numbering" style="display: block; padding: 0px; background-color: transparent; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-top-left-radius: 0px; border-top-right-radius: 0px; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px; word-wrap: normal; background-position: initial initial; background-repeat: initial initial;">ratings_names = [<span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">'user_id'</span>, <span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">'movie_id'</span>, <span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">'rating'</span>, <span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">'timestamp'</span>]ratings = pd.read_table(<span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">'C:\\Users\\Administrator\\Downloads\\ml-1m\\ratings.dat'</span>, sep=<span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">'::'</span>, header=<span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">None</span>, names=ratings_names)movies_names = [<span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">'movie_id'</span>, <span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">'title'</span>, <span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">'genres'</span>]movies = pd.read_table(<span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">'C:\\Users\\Administrator\\Downloads\\ml-1m\\movies.dat'</span>, sep=<span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">'::'</span>, header=<span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">None</span>, names=movies_names)</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li></ul>
D:\Anaconda3\lib\site-packages\ipykernel\__main__.py:2: ParserWarning: Falling back to the 'python' engine because the 'c' engine does not support regex separators; you can avoid this warning by specifying engine='python'.  from ipykernel import kernelapp as appD:\Anaconda3\lib\site-packages\ipykernel\__main__.py:4: ParserWarning: Falling back to the 'python' engine because the 'c' engine does not support regex separators; you can avoid this warning by specifying engine='python'.

加载数据需要一点点时间,应为数据有上百万条. 
查看ratings表,movies表.

<code class="language-python hljs  has-numbering" style="display: block; padding: 0px; background-color: transparent; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-top-left-radius: 0px; border-top-right-radius: 0px; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px; word-wrap: normal; background-position: initial initial; background-repeat: initial initial;">print(len(ratings))ratings.head()</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li></ul>
1000209
 user_idmovie_idratingtimestamp011193597830076011661397830210921914397830196831340849783002754123555978824291
<code class="language-python hljs  has-numbering" style="display: block; padding: 0px; background-color: transparent; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-top-left-radius: 0px; border-top-right-radius: 0px; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px; word-wrap: normal; background-position: initial initial; background-repeat: initial initial;">print(len(movies))movies.head()</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li></ul>
3883
 movie_idtitlegenres01Toy Story (1995)Animation|Children’s|Comedy12Jumanji (1995)Adventure|Children’s|Fantasy23Grumpier Old Men (1995)Comedy|Romance34Waiting to Exhale (1995)Comedy|Drama45Father of the Bride Part II (1995)Comedy

电影的评分的数据有1百万多个. 
将3个表合并为一个表data .

<code class="language-python hljs  has-numbering" style="display: block; padding: 0px; background-color: transparent; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-top-left-radius: 0px; border-top-right-radius: 0px; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px; word-wrap: normal; background-position: initial initial; background-repeat: initial initial;">data = pd.merge(pd.merge(users, ratings), movies)print(len(data))data.head()</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li></ul>
1000209
 user_idgenderageoccupationzipmovie_idratingtimestamptitlegenres01F1104806711935978300760One Flew Over the Cuckoo’s Nest (1975)Drama12M56167007211935978298413One Flew Over the Cuckoo’s Nest (1975)Drama212M25123279311934978220179One Flew Over the Cuckoo’s Nest (1975)Drama315M2572290311934978199279One Flew Over the Cuckoo’s Nest (1975)Drama417M5019535011935978158471One Flew Over the Cuckoo’s Nest (1975)Drama

查看用户id为1,对所有电影的评分.

<code class="language-python hljs  has-numbering" style="display: block; padding: 0px; background-color: transparent; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-top-left-radius: 0px; border-top-right-radius: 0px; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px; word-wrap: normal; background-position: initial initial; background-repeat: initial initial;">data[data.user_id==<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">1</span>]</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul>
 user_idgenderageoccupationzipmovie_idratingtimestamptitlegenres01F1104806711935978300760One Flew Over the Cuckoo’s Nest (1975)Drama17251F110480676613978302109James and the Giant Peach (1996)Animation|Children’s|Musical22501F110480679143978301968My Fair Lady (1964)Musical|Romance28861F1104806734084978300275Erin Brockovich (2000)Drama42011F1104806723555978824291Bug’s Life, A (1998)Animation|Children’s|Comedy59041F1104806711973978302268Princess Bride, The (1987)Action|Adventure|Comedy|Romance82221F1104806712875978302039Ben-Hur (1959)Action|Adventure|Drama89261F1104806728045978300719Christmas Story, A (1983)Comedy|Drama102781F110480675944978302268Snow White and the Seven Dwarfs (1937)Animation|Children’s|Musical110411F110480679194978301368Wizard of Oz, The (1939)Adventure|Children’s|Drama|Musical127591F110480675955978824268Beauty and the Beast (1991)Animation|Children’s|Musical138191F110480679384978301752Gigi (1958)Musical140061F1104806723984978302281Miracle on 34th Street (1947)Drama143861F1104806729184978302124Ferris Bueller’s Day Off (1986)Comedy158591F1104806710355978301753Sound of Music, The (1965)Musical167411F1104806727914978302188Airplane! (1980)Comedy184721F1104806726873978824268Tarzan (1999)Animation|Children’s189141F1104806720184978301777Bambi (1942)Animation|Children’s195031F1104806731055978301713Awakenings (1990)Drama201831F1104806727974978302039Big (1988)Comedy|Fantasy216741F1104806723213978302205Pleasantville (1998)Comedy228321F110480677203978300760Wallace & Gromit: The Best of Aardman Animatio…Animation232701F1104806712705978300055Back to the Future (1985)Comedy|Sci-Fi258531F110480675275978824195Schindler’s List (1993)Drama|War281571F1104806723403978300103Meet Joe Black (1998)Romance285011F11048067485978824351Pocahontas (1995)Animation|Children’s|Musical|Romance288831F1104806710974978301953E.T. the Extra-Terrestrial (1982)Children’s|Drama|Fantasy|Sci-Fi311521F1104806717214978300055Titanic (1997)Drama|Romance326981F1104806715454978824139Ponette (1996)Drama327711F110480677453978824268Close Shave, A (1995)Animation|Comedy|Thriller334281F1104806722944978824291Antz (1998)Animation|Children’s340731F1104806731864978300019Girl, Interrupted (1999)Drama345041F1104806715664978824330Hercules (1997)Adventure|Animation|Children’s|Comedy|Musical349731F110480675884978824268Aladdin (1992)Animation|Children’s|Comedy|Musical363241F1104806719074978824330Mulan (1998)Animation|Children’s368141F110480677834978824291Hunchback of Notre Dame, The (1996)Animation|Children’s|Musical372041F1104806718365978300172Last Days of Disco, The (1998)Drama373391F1104806710225978300055Cinderella (1950)Animation|Children’s|Musical379161F1104806727624978302091Sixth Sense, The (1999)Thriller403751F110480671505978301777Apollo 13 (1995)Drama416261F1104806715978824268Toy Story (1995)Animation|Children’s|Comedy437031F1104806719615978301590Rain Man (1988)Drama450331F1104806719624978301753Driving Miss Daisy (1989)Drama456851F1104806726924978301570Run Lola Run (Lola rennt) (1998)Action|Crime|Romance467571F110480672604978300760Star Wars: Episode IV - A New Hope (1977)Action|Adventure|Fantasy|Sci-Fi497481F1104806710285978301777Mary Poppins (1964)Children’s|Comedy|Musical507591F1104806710295978302205Dumbo (1941)Animation|Children’s|Musical513271F1104806712074978300719To Kill a Mockingbird (1962)Drama522551F1104806720285978301619Saving Private Ryan (1998)Action|Drama|War549081F110480675314978302149Secret Garden, The (1993)Children’s|Drama552461F1104806731144978302174Toy Story 2 (1999)Animation|Children’s|Comedy568311F110480676084978301398Fargo (1996)Crime|Drama|Thriller593441F1104806712464978302091Dead Poets Society (1989)Drama

不同性别对不同电影的平均评分.

<code class="language-python hljs  has-numbering" style="display: block; padding: 0px; background-color: transparent; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-top-left-radius: 0px; border-top-right-radius: 0px; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px; word-wrap: normal; background-position: initial initial; background-repeat: initial initial;">mean_ratings_by_gender = data.pivot_table(values=<span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">'rating'</span>,index=<span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">'title'</span>,columns=<span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">'gender'</span>, aggfunc=<span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">'mean'</span>)mean_ratings_by_gender.head(<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">10</span>)<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">#查看前10条数据</span></code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li></ul>
genderFMtitle  $1,000,000 Duck (1971)3.3750002.761905‘Night Mother (1986)3.3888893.352941‘Til There Was You (1997)2.6756762.733333‘burbs, The (1989)2.7934782.962085…And Justice for All (1979)3.8285713.6890241-900 (1994)2.0000003.00000010 Things I Hate About You (1999)3.6465523.311966101 Dalmatians (1961)3.7914443.500000101 Dalmatians (1996)3.2400002.91121512 Angry Men (1957)4.1843974.328421

mean_ratings_by_gender增加一列,男女的平均评分差.

<code class="language-python hljs  has-numbering" style="display: block; padding: 0px; background-color: transparent; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-top-left-radius: 0px; border-top-right-radius: 0px; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px; word-wrap: normal; background-position: initial initial; background-repeat: initial initial;">mean_ratings_by_gender[<span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">'diff'</span>] = mean_ratings_by_gender.F - mean_ratings_by_gender.Mmean_ratings_by_gender.head()</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li></ul>
genderFMdifftitle   $1,000,000 Duck (1971)3.3750002.7619050.613095‘Night Mother (1986)3.3888893.3529410.035948‘Til There Was You (1997)2.6756762.733333-0.057658‘burbs, The (1989)2.7934782.962085-0.168607…And Justice for All (1979)3.8285713.6890240.139547

哪些电影是男女评分差异最大的(男性评分高女生评分低,女性高男性低).

<code class="language-python hljs  has-numbering" style="display: block; padding: 0px; background-color: transparent; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-top-left-radius: 0px; border-top-right-radius: 0px; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px; word-wrap: normal; background-position: initial initial; background-repeat: initial initial;">mean_ratings_by_gender.sort_values(by=<span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">'diff'</span>,ascending=<span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">True</span>).head()<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">#男高女低</span></code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li></ul>
genderFMdifftitle   Tigrero: A Film That Was Never Made (1994)1.04.333333-3.333333Neon Bible, The (1995)1.04.000000-3.000000Enfer, L’ (1994)1.03.750000-2.750000Stalingrad (1993)1.03.593750-2.593750Killer: A Journal of Murder (1995)1.03.428571-2.428571
<code class="language-python hljs  has-numbering" style="display: block; padding: 0px; background-color: transparent; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-top-left-radius: 0px; border-top-right-radius: 0px; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px; word-wrap: normal; background-position: initial initial; background-repeat: initial initial;">mean_ratings_by_gender.sort_values(by=<span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">'diff'</span>,ascending=<span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">False</span>).head()<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">#女高男低</span></code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li></ul>
genderFMdifftitle   James Dean Story, The (1957)4.0000001.0000003.000000Spiders, The (Die Spinnen, 1. Teil: Der Goldene See) (1919)4.0000001.0000003.000000Country Life (1994)5.0000002.0000003.000000Babyfever (1994)3.6666671.0000002.666667Woman of Paris, A (1923)5.0000002.4285712.571429

不同电影的评分次数.

<code class="language-python hljs  has-numbering" style="display: block; padding: 0px; background-color: transparent; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-top-left-radius: 0px; border-top-right-radius: 0px; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px; word-wrap: normal; background-position: initial initial; background-repeat: initial initial;">total_rating_by_title = data.groupby(<span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">'title'</span>).size()total_rating_by_title    <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">#第一列是电影标题,第二列是评分次数</span></code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li></ul>
title$1,000,000 Duck (1971)                              37'Night Mother (1986)                                70'Til There Was You (1997)                           52'burbs, The (1989)                                 303...And Justice for All (1979)                      1991-900 (1994)                                         210 Things I Hate About You (1999)                  700101 Dalmatians (1961)                              565101 Dalmatians (1996)                              36412 Angry Men (1957)                                61613th Warrior, The (1999)                           750187 (1997)                                          552 Days in the Valley (1996)                        28620 Dates (1998)                                    13920,000 Leagues Under the Sea (1954)                575200 Cigarettes (1999)                              1812001: A Space Odyssey (1968)                      17162010 (1984)                                        47024 7: Twenty Four Seven (1997)                       524-hour Woman (1998)                                 928 Days (2000)                                     5053 Ninjas: High Noon On Mega Mountain (1998)         473 Strikes (2000)                                     4301, 302 (1995)                                      939 Steps, The (1935)                               253400 Blows, The (Les Quatre cents coups) (1959)     18742 Up (1998)                                        8852 Pick-Up (1986)                                  14054 (1998)                                          2597th Voyage of Sinbad, The (1958)                   258                                                  ... Wrongfully Accused (1998)                          123Wyatt Earp (1994)                                  270X-Files: Fight the Future, The (1998)              996X-Men (2000)                                      1511X: The Unknown (1956)                               12Xiu Xiu: The Sent-Down Girl (Tian yu) (1998)        69Yankee Zulu (1994)                                   2Yards, The (1999)                                   77Year My Voice Broke, The (1987)                     27Year of Living Dangerously (1982)                  391Year of the Horse (1997)                             4Yellow Submarine (1968)                            399Yojimbo (1961)                                     215You Can't Take It With You (1938)                   77You So Crazy (1994)                                 13You've Got Mail (1998)                             838Young Doctors in Love (1982)                        79Young Frankenstein (1974)                         1193Young Guns (1988)                                  562Young Guns II (1990)                               369Young Poisoner's Handbook, The (1995)               79Young Sherlock Holmes (1985)                       379Young and Innocent (1937)                           10Your Friends and Neighbors (1998)                  109Zachariah (1971)                                     2Zed & Two Noughts, A (1985)                         29Zero Effect (1998)                                 301Zero Kelvin (Kj鎟lighetens kj鴗ere) (1995)             2Zeus and Roxanne (1997)                             23eXistenZ (1999)                                    410dtype: int64

评分次数最多的10部电影.

<code class="language-python hljs  has-numbering" style="display: block; padding: 0px; background-color: transparent; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-top-left-radius: 0px; border-top-right-radius: 0px; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px; word-wrap: normal; background-position: initial initial; background-repeat: initial initial;">top_10_total_rating = total_rating_by_title.sort_values(ascending=<span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">False</span>).head(<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">10</span>)top_10_total_rating</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li></ul>
titleAmerican Beauty (1999)                                   3428Star Wars: Episode IV - A New Hope (1977)                2991Star Wars: Episode V - The Empire Strikes Back (1980)    2990Star Wars: Episode VI - Return of the Jedi (1983)        2883Jurassic Park (1993)                                     2672Saving Private Ryan (1998)                               2653Terminator 2: Judgment Day (1991)                        2649Matrix, The (1999)                                       2590Back to the Future (1985)                                2583Silence of the Lambs, The (1991)                         2578dtype: int64
<code class="language-python hljs  has-numbering" style="display: block; padding: 0px; background-color: transparent; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-top-left-radius: 0px; border-top-right-radius: 0px; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px; word-wrap: normal; background-position: initial initial; background-repeat: initial initial;">可以看出,评分次数最多的电影一般是我们比较熟知的电影,一般可认为是热门电影.再来看看评分最高的<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">10</span>大电影(注:最高分为<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">5.0</span>)</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li></ul>
<code class="language-python hljs  has-numbering" style="display: block; padding: 0px; background-color: transparent; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-top-left-radius: 0px; border-top-right-radius: 0px; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px; word-wrap: normal; background-position: initial initial; background-repeat: initial initial;">mean_ratings_by_title = data.pivot_table(values=<span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">'rating'</span>,index=<span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">'title'</span>,aggfunc=<span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">'mean'</span>)top_10_mean_ratings = mean_ratings_by_title.sort_values(ascending=<span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">False</span>).head(<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">10</span>)top_10_mean_ratings</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li></ul>
titleGate of Heavenly Peace, The (1995)           5.0Lured (1947)                                 5.0Ulysses (Ulisse) (1954)                      5.0Smashing Time (1967)                         5.0Follow the Bitch (1998)                      5.0Song of Freedom (1936)                       5.0Bittersweet Motel (2000)                     5.0Baby, The (1973)                             5.0One Little Indian (1973)                     5.0Schlafes Bruder (Brother of Sleep) (1995)    5.0Name: rating, dtype: float64
<code class="language-python hljs  has-numbering" style="display: block; padding: 0px; background-color: transparent; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-top-left-radius: 0px; border-top-right-radius: 0px; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px; word-wrap: normal; background-position: initial initial; background-repeat: initial initial;">评分人数最多的<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">10</span>部电影的平均评分.</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul>
<code class="language-python hljs  has-numbering" style="display: block; padding: 0px; background-color: transparent; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-top-left-radius: 0px; border-top-right-radius: 0px; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px; word-wrap: normal; background-position: initial initial; background-repeat: initial initial;">mean_ratings_by_title[top_10_total_rating.index]</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul>
titleAmerican Beauty (1999)                                   4.317386Star Wars: Episode IV - A New Hope (1977)                4.453694Star Wars: Episode V - The Empire Strikes Back (1980)    4.292977Star Wars: Episode VI - Return of the Jedi (1983)        4.022893Jurassic Park (1993)                                     3.763847Saving Private Ryan (1998)                               4.337354Terminator 2: Judgment Day (1991)                        4.058513Matrix, The (1999)                                       4.315830Back to the Future (1985)                                3.990321Silence of the Lambs, The (1991)                         4.351823Name: rating, dtype: float64
<code class="language-python hljs  has-numbering" style="display: block; padding: 0px; background-color: transparent; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-top-left-radius: 0px; border-top-right-radius: 0px; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px; word-wrap: normal; background-position: initial initial; background-repeat: initial initial;">可以了解到评论人数最多的<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">10</span>部电影在平均评分最高的<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">10</span>大中排名并不高,评分高的电影有一部分是我们不熟知的电影,是不是数据有问题呢?其实不是,假如有某部烂片,去观影的人很少,这很少的人给了很高的评分,所以导致一些评论人数很少但平均评分和高的电影.</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li></ul>
<code class="language-python hljs  has-numbering" style="display: block; padding: 0px; background-color: transparent; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-top-left-radius: 0px; border-top-right-radius: 0px; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px; word-wrap: normal; background-position: initial initial; background-repeat: initial initial;">如若不信,请看数据,评分最高的<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">10</span>大电影的评论次数</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul>
<code class="language-python hljs  has-numbering" style="display: block; padding: 0px; background-color: transparent; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-top-left-radius: 0px; border-top-right-radius: 0px; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px; word-wrap: normal; background-position: initial initial; background-repeat: initial initial;">total_rating_by_title[top_10_mean_ratings.index]</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul>
titleGate of Heavenly Peace, The (1995)           3Lured (1947)                                 1Ulysses (Ulisse) (1954)                      1Smashing Time (1967)                         2Follow the Bitch (1998)                      1Song of Freedom (1936)                       1Bittersweet Motel (2000)                     1Baby, The (1973)                             1One Little Indian (1973)                     1Schlafes Bruder (Brother of Sleep) (1995)    1dtype: int64
<code class="language-python hljs  has-numbering" style="display: block; padding: 0px; background-color: transparent; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-top-left-radius: 0px; border-top-right-radius: 0px; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px; word-wrap: normal; background-position: initial initial; background-repeat: initial initial;">现在来重新统计<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">10</span>大热门电影,此处认为热门电影至少有<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">1000</span>人评论。统计出热门电影</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li></ul>
<code class="language-python hljs  has-numbering" style="display: block; padding: 0px; background-color: transparent; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-top-left-radius: 0px; border-top-right-radius: 0px; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px; word-wrap: normal; background-position: initial initial; background-repeat: initial initial;">hot_movie = total_rating_by_title[total_rating_by_title><span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">1000</span>]print(len(hot_movie))hot_movie</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li></ul>
207title2001: A Space Odyssey (1968)                          1716Abyss, The (1989)                                     1715African Queen, The (1951)                             1057Air Force One (1997)                                  1076Airplane! (1980)                                      1731Aladdin (1992)                                        1351Alien (1979)                                          2024Aliens (1986)                                         1820Amadeus (1984)                                        1382American Beauty (1999)                                3428American Pie (1999)                                   1389American President, The (1995)                        1033Animal House (1978)                                   1207Annie Hall (1977)                                     1334Apocalypse Now (1979)                                 1176Apollo 13 (1995)                                      1251Arachnophobia (1990)                                  1367Armageddon (1998)                                     1110As Good As It Gets (1997)                             1424Austin Powers: International Man of Mystery (1997)    1205Austin Powers: The Spy Who Shagged Me (1999)          1434Babe (1995)                                           1751Back to the Future (1985)                             2583Back to the Future Part II (1989)                     1158Back to the Future Part III (1990)                    1148Batman (1989)                                         1431Batman Returns (1992)                                 1031Beauty and the Beast (1991)                           1060Beetlejuice (1988)                                    1495Being John Malkovich (1999)                           2241                                                      ... Superman (1978)                                       1222Talented Mr. Ripley, The (1999)                       1331Taxi Driver (1976)                                    1240Terminator 2: Judgment Day (1991)                     2649Terminator, The (1984)                                2098Thelma & Louise (1991)                                1417There's Something About Mary (1998)                   1371This Is Spinal Tap (1984)                             1118Thomas Crown Affair, The (1999)                       1089Three Kings (1999)                                    1021Time Bandits (1981)                                   1010Titanic (1997)                                        1546Top Gun (1986)                                        1010Total Recall (1990)                                   1996Toy Story (1995)                                      2077Toy Story 2 (1999)                                    1585True Lies (1994)                                      1400Truman Show, The (1998)                               1005Twelve Monkeys (1995)                                 1511Twister (1996)                                        1110Untouchables, The (1987)                              1127Usual Suspects, The (1995)                            1783Wayne's World (1992)                                  1120When Harry Met Sally... (1989)                        1568Who Framed Roger Rabbit? (1988)                       1799Willy Wonka and the Chocolate Factory (1971)          1313Witness (1985)                                        1046Wizard of Oz, The (1939)                              1718X-Men (2000)                                          1511Young Frankenstein (1974)                             1193dtype: int64
<code class="language-python hljs  has-numbering" style="display: block; padding: 0px; background-color: transparent; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-top-left-radius: 0px; border-top-right-radius: 0px; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px; word-wrap: normal; background-position: initial initial; background-repeat: initial initial;"><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">#热门电影的评分</span>hot_movie_mean_rating = mean_ratings_by_title[hot_movie.index]print(len(hot_movie_mean_rating))hot_movie_mean_rating</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li></ul>
207title2001: A Space Odyssey (1968)                          4.068765Abyss, The (1989)                                     3.683965African Queen, The (1951)                             4.251656Air Force One (1997)                                  3.588290Airplane! (1980)                                      3.971115Aladdin (1992)                                        3.788305Alien (1979)                                          4.159585Aliens (1986)                                         4.125824Amadeus (1984)                                        4.251809American Beauty (1999)                                4.317386American Pie (1999)                                   3.709863American President, The (1995)                        3.793804Animal House (1978)                                   4.053024Annie Hall (1977)                                     4.141679Apocalypse Now (1979)                                 4.243197Apollo 13 (1995)                                      4.073541Arachnophobia (1990)                                  3.002926Armageddon (1998)                                     3.191892As Good As It Gets (1997)                             3.950140Austin Powers: International Man of Mystery (1997)    3.710373Austin Powers: The Spy Who Shagged Me (1999)          3.388424Babe (1995)                                           3.891491Back to the Future (1985)                             3.990321Back to the Future Part II (1989)                     3.343696Back to the Future Part III (1990)                    3.242160Batman (1989)                                         3.600978Batman Returns (1992)                                 2.976722Beauty and the Beast (1991)                           3.885849Beetlejuice (1988)                                    3.567893Being John Malkovich (1999)                           4.125390                                                        ...   Superman (1978)                                       3.536825Talented Mr. Ripley, The (1999)                       3.503381Taxi Driver (1976)                                    4.183871Terminator 2: Judgment Day (1991)                     4.058513Terminator, The (1984)                                4.152050Thelma & Louise (1991)                                3.680311There's Something About Mary (1998)                   3.904449This Is Spinal Tap (1984)                             4.179785Thomas Crown Affair, The (1999)                       3.641873Three Kings (1999)                                    3.807052Time Bandits (1981)                                   3.694059Titanic (1997)                                        3.583441Top Gun (1986)                                        3.686139Total Recall (1990)                                   3.682365Toy Story (1995)                                      4.146846Toy Story 2 (1999)                                    4.218927True Lies (1994)                                      3.634286Truman Show, The (1998)                               3.861692Twelve Monkeys (1995)                                 3.945731Twister (1996)                                        3.173874Untouchables, The (1987)                              4.007986Usual Suspects, The (1995)                            4.517106Wayne's World (1992)                                  3.600893When Harry Met Sally... (1989)                        4.073342Who Framed Roger Rabbit? (1988)                       3.679822Willy Wonka and the Chocolate Factory (1971)          3.861386Witness (1985)                                        3.996176Wizard of Oz, The (1939)                              4.247963X-Men (2000)                                          3.820649Young Frankenstein (1974)                             4.250629Name: rating, dtype: float64
<code class="language-python hljs  has-numbering" style="display: block; padding: 0px; background-color: transparent; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-top-left-radius: 0px; border-top-right-radius: 0px; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px; word-wrap: normal; background-position: initial initial; background-repeat: initial initial;"><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">#评论人数>=1000的10大评分最高电影</span>top_10_rating_movie = hot_movie_mean_rating.sort_values(ascending=<span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">False</span>).head(<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">10</span>)top_10_rating_movie</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li></ul>
titleShawshank Redemption, The (1994)                                               4.554558Godfather, The (1972)                                                          4.524966Usual Suspects, The (1995)                                                     4.517106Schindler's List (1993)                                                        4.510417Raiders of the Lost Ark (1981)                                                 4.477725Rear Window (1954)                                                             4.476190Star Wars: Episode IV - A New Hope (1977)                                      4.453694Dr. Strangelove or: How I Learned to Stop Worrying and Love the Bomb (1963)    4.449890Casablanca (1942)                                                              4.412822Sixth Sense, The (1999)                                                        4.406263Name: rating, dtype: float64
<code class="language-python hljs  has-numbering" style="display: block; padding: 0px; background-color: transparent; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-top-left-radius: 0px; border-top-right-radius: 0px; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px; word-wrap: normal; background-position: initial initial; background-repeat: initial initial;">%matplotlib inline <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">#在ipython(或jupyter)中使用此命令,其他则不必</span><span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">import</span> matplotlib.pyplot <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">as</span> plt<span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">import</span> numpy <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">as</span> npx = np.arange(<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">1</span>,<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">11</span>)y = top_10_rating_movie.valuesname = top_10_rating_movie.index<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">#画出图像</span>plt.plot(x, y, <span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">'r-o'</span>)<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">#添加注释</span><span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">for</span> i <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">in</span> range(<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">10</span>):    plt.text(x[i], y[i], name[i])<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">#设置坐标范围</span>plt.xlim(<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">0</span>, <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">15</span>)plt.ylim(<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">4.4</span>, <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">4.56</span>)<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">#设置坐标标题</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">#plt.xlabel('Rank')</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">#plt.ylabel=('Rating')</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">#plt.show() #非ipython用户使用此命令</span></code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li><li style="box-sizing: border-box; padding: 0px 5px;">6</li><li style="box-sizing: border-box; padding: 0px 5px;">7</li><li style="box-sizing: border-box; padding: 0px 5px;">8</li><li style="box-sizing: border-box; padding: 0px 5px;">9</li><li style="box-sizing: border-box; padding: 0px 5px;">10</li><li style="box-sizing: border-box; padding: 0px 5px;">11</li><li style="box-sizing: border-box; padding: 0px 5px;">12</li><li style="box-sizing: border-box; padding: 0px 5px;">13</li><li style="box-sizing: border-box; padding: 0px 5px;">14</li><li style="box-sizing: border-box; padding: 0px 5px;">15</li><li style="box-sizing: border-box; padding: 0px 5px;">16</li><li style="box-sizing: border-box; padding: 0px 5px;">17</li><li style="box-sizing: border-box; padding: 0px 5px;">18</li><li style="box-sizing: border-box; padding: 0px 5px;">19</li><li style="box-sizing: border-box; padding: 0px 5px;">20</li><li style="box-sizing: border-box; padding: 0px 5px;">21</li><li style="box-sizing: border-box; padding: 0px 5px;">22</li><li style="box-sizing: border-box; padding: 0px 5px;">23</li><li style="box-sizing: border-box; padding: 0px 5px;">24</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li><li style="box-sizing: border-box; padding: 0px 5px;">6</li><li style="box-sizing: border-box; padding: 0px 5px;">7</li><li style="box-sizing: border-box; padding: 0px 5px;">8</li><li style="box-sizing: border-box; padding: 0px 5px;">9</li><li style="box-sizing: border-box; padding: 0px 5px;">10</li><li style="box-sizing: border-box; padding: 0px 5px;">11</li><li style="box-sizing: border-box; padding: 0px 5px;">12</li><li style="box-sizing: border-box; padding: 0px 5px;">13</li><li style="box-sizing: border-box; padding: 0px 5px;">14</li><li style="box-sizing: border-box; padding: 0px 5px;">15</li><li style="box-sizing: border-box; padding: 0px 5px;">16</li><li style="box-sizing: border-box; padding: 0px 5px;">17</li><li style="box-sizing: border-box; padding: 0px 5px;">18</li><li style="box-sizing: border-box; padding: 0px 5px;">19</li><li style="box-sizing: border-box; padding: 0px 5px;">20</li><li style="box-sizing: border-box; padding: 0px 5px;">21</li><li style="box-sizing: border-box; padding: 0px 5px;">22</li><li style="box-sizing: border-box; padding: 0px 5px;">23</li><li style="box-sizing: border-box; padding: 0px 5px;">24</li></ul>

png

<code class="language-python hljs  has-numbering" style="display: block; padding: 0px; background-color: transparent; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-top-left-radius: 0px; border-top-right-radius: 0px; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px; word-wrap: normal; background-position: initial initial; background-repeat: initial initial;">这图太丑,献上下图:</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul>
<code class="language-python hljs  has-numbering" style="display: block; padding: 0px; background-color: transparent; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-top-left-radius: 0px; border-top-right-radius: 0px; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px; word-wrap: normal; background-position: initial initial; background-repeat: initial initial;"><span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">import</span> matplotlib.pyplot <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">as</span> plt<span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">import</span> numpy <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">as</span> npplt.rcdefaults()people = namey_pos = np.arange(len(people))performance = yerror = np.random.rand(len(people))plt.barh(y_pos, performance, xerr=error, align=<span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">'center'</span>, alpha=<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">0.4</span>)plt.yticks(y_pos, people)<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">#plt.xlabel('Rating')</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">#plt.title('Rank')</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">#plt.show() #非ipython用户使用此命令</span></code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li><li style="box-sizing: border-box; padding: 0px 5px;">6</li><li style="box-sizing: border-box; padding: 0px 5px;">7</li><li style="box-sizing: border-box; padding: 0px 5px;">8</li><li style="box-sizing: border-box; padding: 0px 5px;">9</li><li style="box-sizing: border-box; padding: 0px 5px;">10</li><li style="box-sizing: border-box; padding: 0px 5px;">11</li><li style="box-sizing: border-box; padding: 0px 5px;">12</li><li style="box-sizing: border-box; padding: 0px 5px;">13</li><li style="box-sizing: border-box; padding: 0px 5px;">14</li><li style="box-sizing: border-box; padding: 0px 5px;">15</li><li style="box-sizing: border-box; padding: 0px 5px;">16</li><li style="box-sizing: border-box; padding: 0px 5px;">17</li><li style="box-sizing: border-box; padding: 0px 5px;">18</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li><li style="box-sizing: border-box; padding: 0px 5px;">6</li><li style="box-sizing: border-box; padding: 0px 5px;">7</li><li style="box-sizing: border-box; padding: 0px 5px;">8</li><li style="box-sizing: border-box; padding: 0px 5px;">9</li><li style="box-sizing: border-box; padding: 0px 5px;">10</li><li style="box-sizing: border-box; padding: 0px 5px;">11</li><li style="box-sizing: border-box; padding: 0px 5px;">12</li><li style="box-sizing: border-box; padding: 0px 5px;">13</li><li style="box-sizing: border-box; padding: 0px 5px;">14</li><li style="box-sizing: border-box; padding: 0px 5px;">15</li><li style="box-sizing: border-box; padding: 0px 5px;">16</li><li style="box-sizing: border-box; padding: 0px 5px;">17</li><li style="box-sizing: border-box; padding: 0px 5px;">18</li></ul>

0 0