导入数据

import pandas as pd
movie= pd.read_csv('movie.csv')
movie.head()
RankTitleGenreDescriptionDirector...Runtime (Minutes)RatingVotesRevenue (Millions)Metascore
01Guardians of the GalaxyAction,Adventure,Sci-FiA group of intergalactic criminals are forced ...James Gunn...1218.1757074333.1376.0
12PrometheusAdventure,Mystery,Sci-FiFollowing clues to the origin of mankind, a te...Ridley Scott...1247.0485820126.4665.0
23SplitHorror,ThrillerThree girls are kidnapped by a man with a diag...M. Night Shyamalan...1177.3157606138.1262.0
34SingAnimation,Comedy,FamilyIn a city of humanoid animals, a hustling thea...Christophe Lourdelet...1087.260545270.3259.0
45Suicide SquadAction,Adventure,FantasyA secret government agency recruits some of th...David Ayer...1236.2393727325.0240.0

5 rows × 12 columns

Rating的中位分位数 

# Rating的中位分位数
rating=movie.Rating
rating.quantile()
#6.8

分位数计算,百分之99.5的.

#分位数计算,百分之99.5的。
rating.quantile(0.995)
#8.6

求最小值、最大值、平均值、中位数、标准差、总和

rating.min()
#1.9

rating.max()
#9.0

rating.mean()
#6.723200000000003

rating.median()
#6.8

rating.std()
#0.9454287892779637

rating.sum()
#6723.2

打印描述信息

rating.describe()

count    1000.000000
mean        6.723200
std         0.945429
min         1.900000
25%         6.200000
50%         6.800000
75%         7.400000
max         9.000000
Name: Rating, dtype: float64

二分位数

rating.quantile(.2)
#6.0

各个十分之几分位数

rating.quantile([.1, .2, .3, .4, .5, .6, .7, .8, .9])

#显示结果
0.1    5.5
0.2    6.0
0.3    6.3
0.4    6.6
      ... 
0.6    7.0
0.7    7.3
0.8    7.5
0.9    7.9
Name: Rating, Length: 9, dtype: float64

 

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐