pandas.describe 输出参数解释

版权声明:报名咨询QQ:3246333637,本文为 张晨光老师 创作,未经博主允许不得转载 https://blog.csdn.net/zhangchen124/article/details/83210907
import pandas as pd
import numpy as np

dates=pd.date_range('20081001',periods=7)
df=pd.DataFrame(np.random.randn(7,4),index=dates,columns=list('ABCD'))
print("index is:")
print(df.index)
print("column is:")
print(df.columns)
print("value is:")
print(df.values)
print("-"*32)
print(df.describe())

D:\Programs\Python\Python36\python.exe D:/aaa/pandasdemo/pandas2.py
index is:
DatetimeIndex(['2008-10-01', '2008-10-02', '2008-10-03', '2008-10-04',
               '2008-10-05', '2008-10-06', '2008-10-07'],
              dtype='datetime64[ns]', freq='D')
column is:
Index(['A', 'B', 'C', 'D'], dtype='object')
value is:
[[ 0.63424428  1.10095283 -0.66181727 -0.65113561]
 [-0.87622164  1.24320172 -2.20035782  0.50736403]
 [ 2.52492648  0.16699796  0.35049536 -1.8868142 ]
 [ 1.30422257  0.10991641  0.85137072 -1.40550629]
 [-0.80097511 -0.1881843  -0.75235661 -0.89326946]
 [-0.62392825  0.65573963  0.7682292  -1.15338121]
 [-0.1981631  -0.36213939 -0.49770702 -1.39590736]]
--------------------------------
              A         B         C         D
count  7.000000  7.000000  7.000000  7.000000
mean   0.280586  0.389498 -0.306020 -0.982664
std    1.275754  0.623459  1.070486  0.767494
min   -0.876222 -0.362139 -2.200358 -1.886814
25%   -0.712452 -0.039134 -0.707087 -1.400707
50%   -0.198163  0.166998 -0.497707 -1.153381
75%    0.969233  0.878346  0.559362 -0.772203
max    2.524926  1.243202  0.851371  0.507364

Process finished with exit code 0

注释:

对于数值数据,结果的索引将包括计数,平均值,标准差,最小值,最大值以及较低的百分位数和50。默认情况下,较低的百分位数为25,较高的百分位数为75.50百分位数与中位数相同。

猜你喜欢

转载自blog.csdn.net/zhangchen124/article/details/83210907
今日推荐