DataFrame操作获取数据数量,维度,长度,各列值的个数,描述信息
pd.options.display.max_rows = 8movie = pd.read_csv('movie.csv')# 打印行数和列数movie.shape#(1000, 12)# 打印数据的个数movie.size#12000# 该数据集的维度movie.ndim#2# 该数据集的长度len(movie)#1000# 各个列的值的个数movie.count()'''Rank1000Ti
·
pd.options.display.max_rows = 8
movie = pd.read_csv('movie.csv')
# 打印行数和列数
movie.shape
#(1000, 12)
# 打印数据的个数
movie.size
#12000
# 该数据集的维度
movie.ndim
#2
# 该数据集的长度
len(movie)
#1000
# 各个列的值的个数
movie.count()
'''
Rank 1000
Title 1000
Genre 1000
Description 1000
...
Rating 1000
Votes 1000
Revenue (Millions) 872
Metascore 936
Length: 12, dtype: int64
'''
# 各列的最小值
movie.min()
'''
Rank 1
Title (500) Days of Summer
Genre Action
Description "21" is the fact-based story about six MIT stu...
...
Rating 1.9
Votes 61
Revenue (Millions) 0
Metascore 11
Length: 12, dtype: object
'''
# 打印描述信息
movie.describe()
Rank | Year | Runtime (Minutes) | Rating | Votes | Revenue (Millions) | Metascore | |
---|---|---|---|---|---|---|---|
count | 1000.000000 | 1000.000000 | 1000.000000 | 1000.000000 | 1.000000e+03 | 872.000000 | 936.000000 |
mean | 500.500000 | 2012.783000 | 113.172000 | 6.723200 | 1.698083e+05 | 82.956376 | 58.985043 |
std | 288.819436 | 3.205962 | 18.810908 | 0.945429 | 1.887626e+05 | 103.253540 | 17.194757 |
min | 1.000000 | 2006.000000 | 66.000000 | 1.900000 | 6.100000e+01 | 0.000000 | 11.000000 |
25% | 250.750000 | 2010.000000 | 100.000000 | 6.200000 | 3.630900e+04 | 13.270000 | 47.000000 |
50% | 500.500000 | 2014.000000 | 111.000000 | 6.800000 | 1.107990e+05 | 47.985000 | 59.500000 |
75% | 750.250000 | 2016.000000 | 123.000000 | 7.400000 | 2.399098e+05 | 113.715000 | 72.000000 |
max | 1000.000000 | 2016.000000 | 191.000000 | 9.000000 | 1.791916e+06 | 936.630000 | 100.000000 |
更多推荐
已为社区贡献13条内容
所有评论(0)