scipy.stats.describe(array, axis=0)
計算沿數組指定軸傳遞的數組元素的描述性統計信息。
參數:
array:輸入數組或對象具有用於計算統計信息的元素。
axis:要沿其計算統計信息的軸。默認情況下,軸= 0。
返回:基於設置參數的數組元素的統計信息。
代碼1:
# FInding statistics of data
from scipy import stats
arr1 = [9, 3, 27]
desc = stats.describe(arr1)
print("No. of observations is:\n", desc)
No. of observations is:
DescribeResult(nobs=3, minmax=(3, 27), mean=13.0, variance=156.0, skewness=0.5280049792181878, kurtosis=-1.5)
代碼2:多維數據
# FInding statistics of data
from scipy import stats
arr1 = [[1, 3, 27],
[3, 4, 6],
[7, 6, 3],
[3, 6, 8]]
desc = stats.describe(arr1, axis = 0)
print("No. of observations at axis = 0:\n\n", desc)
print("\n\nNo. of observations at axis = 1:\n\n", desc)
No. of observations at axis = 0:
DescribeResult(nobs=4, minmax=(array([1, 3, 3]), array([ 7, 6, 27])), mean=array([ 3.5 , 4.75, 11. ]), variance=array([ 6.33333333, 2.25 , 118. ]), skewness=array([ 0.65202366, -0.21383343, 1.03055786]), kurtosis=array([-0.90304709, -1.72016461, -0.75485971]))
No. of observations at axis = 1:
DescribeResult(nobs=4, minmax=(array([1, 3, 3]), array([ 7, 6, 27])), mean=array([ 3.5 , 4.75, 11. ]), variance=array([ 6.33333333, 2.25 , 118. ]), skewness=array([ 0.65202366, -0.21383343, 1.03055786]), kurtosis=array([-0.90304709, -1.72016461, -0.75485971]))
相關用法
- Python Scipy stats.mean()用法及代碼示例
- Python Scipy stats.sem()用法及代碼示例
- Python Scipy stats.tmin()用法及代碼示例
- Python Scipy stats.tsem()用法及代碼示例
- Python Scipy stats.binned_statistic_2d()用法及代碼示例
- Python Scipy stats.tmax()用法及代碼示例
- Python Scipy stats.tstd()用法及代碼示例
- Python Scipy stats.binned_statistic_dd()用法及代碼示例
- Python Scipy stats.binned_statistic()用法及代碼示例
- Python Scipy stats.bayes_mvs()用法及代碼示例
- Python Scipy stats.kurtosistest()用法及代碼示例
- Python Scipy stats.gmean()用法及代碼示例
注:本文由純淨天空篩選整理自vishal3096大神的英文原創作品 sciPy stats.describe() function | Python。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。