Result analysis

 

Above image observations – 

A - P = 2 
A - Q = 3 
A - R = 0

 

Above image observations:

B - P  = 1
B - Q  = 0
B - R  = 4

stats.describe()

This function basically calculates the several descriptive statistics of the argument array.

Syntax:

scipy.stats.describe(a, axis=0, ddof=1, bias=True, nan_policy=’propagate’)

where,

  1. Input array – array for which we want to generate the statistics.
  2. axis ( int , float ) { # optional } – Axis along which statistics are calculated. The default axis is 0.
  3. ddof ( int ) { # optional } – Delta Degrees for variance. Default ddof = 1.
  4. bias ( bool ) { # optional } – skewness and kurtosis calculations for statistical bias.
  5. nan_policy – { ‘propagate’,’raise’,’omit’ } { # optional ) – Handle the NAN inputs.

Return:

  1. nbos  ( int or ndarray ) – length of data along axis value.
  2. minmax  ( tuple of ndarrays or floats ) – Minimum and Maximum value of input array along the given axis.
  3. mean ( float or ndarray ) – mean of input array.
  4. variance ( ndarray or float ) – variance of input array along the given axis.
  5. skewness ( float or ndarray ) – skewness of input array along the given axis.
  6. kurtosis ( ndarray or float ) – kurtosis of input array along the given axis.

Python3

# importing the stats and numpy module
from scipy import stats as st
import numpy as npy
 
# ID input array
array = npy.array([10, 20, 30, 40, 50, 60, 70, 80])
 
# calling the describe function
print(st.describe(array))

                    

Output:

DescribeResult(
 nobs=8,
 minmax=(10, 80),
 mean=45.0,
 variance=600.0,
 skewness=0.0,
 kurtosis=-1.2380952380952381)

Python3

# importing the stats and numpy module
from scipy import stats as st
import numpy as npy
 
# 2D array
nd = npy.array([[5, 6], [2, 3], [5, 5],\
                [7, 9], [9, 8], [8, 7]])
 
# calling the describe function
print(st.describe(nd))

                    

Output:

DescribeResult(nobs=6,
 minmax=(array([2, 3]),
 array([9, 9])),
 mean=array([6.        , 6.33333333]),
 variance=array([6.4       , 4.66666667]),
 skewness=array([-0.40594941, -0.3380617 ]),
 kurtosis=array([-0.9140625, -0.96     ]))

SciPy – Stats

The scipy.stats is the SciPy sub-package. It is mainly used for probabilistic distributions and statistical operations. There is a wide range of probability functions.

There are three classes:

Class

Description

rv_continuousFor continuous random variables, we can create specialized distribution subclasses and instances.
rv_discreteFor discrete random variables, we can create specialized distribution subclasses and instances.
rv_histogramgenerate specific distribution histograms.

Similar Reads

Continuous Random Variables

A continuous random variable is a probability distribution when the random variable X can have any value. The mean is defined by the location (loc) keyword. The standard deviation is determined by the scale (scale) keyword....

Discrete Random Variables

...

Result analysis

Only a countable number of values can be assigned to discrete random variables. L is an additional integer parameter that can be added to any discrete distribution. The general distribution p and the standard distribution p0 have the following relationship:...

scipy.stats.kurtosis

...

scipy.stats.mstats.zscore

...

scipy.stats.skew

...

scipy.stats.energy_distance

...

scipy.stats.mode

...

scipy.stats.variation

Kurtosis quantifies how much of a probability distribution’s data are concentrated towards the mean as opposed to the tails....

scipy.stats.rankdata

...

Contact Us