scipy.stats.describe(array, axis=0) computes the descriptive statistics of the passed array elements along the specified axis of the array.
Parameters :
array: Input array or object having the elements to calculate the statistics.
axis: Axis along which the statistics is to be computed. By default axis = 0.Returns : Statistics of the array elements based on the set parameters.
Code #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)
Code #2: With multi-dimensional data
# 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]))
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.
Recommended Posts:
- sciPy stats.tsem() function | Python
- sciPy stats.tvar() function | Python
- sciPy stats.gmean() function | Python
- scipy stats.tmin() function | Python
- sciPy stats.tstd() function | Python
- sciPy stats.tmax() function | Python
- sciPy stats.mean() function | Python
- sciPy stats.nanmedian() function | Python
- sciPy stats.nanstd() function | Python
- sciPy stats.nanmean() function | Python
- scipy stats.moment() function | Python
- scipy stats.mode() function | Python
- scipy stats.normaltest() function | Python
- scipy stats.skewtest() function | Python
- scipy stats.kurtosis() function | Python
- scipy stats.kurtosistest() function | Python
- sciPy stats.relfreq() function | Python
- sciPy stats.scoreatpercentile() function | Python
- sciPy stats.itemfreq() function | Python
- sciPy stats.histogram() function | Python
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

