1. 程式人生 > >pandas.describe 輸出引數解釋

pandas.describe 輸出引數解釋

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百分位數與中位數相同。