spkit.stats.get_stats

spkit.stats.get_stats(x, detail_level=1, name='x', esp=1e-05, add_esp=False)

Statistics of a given sequence x, excluding NaN values

returns stats and names of statistics measures

Parameters:
x: 1d-array
  • array of numbers

detail_level: int {1,2,3}
  • level of details

  • For detail_level=1, 6 values:
    • [‘mean’,’sd’,’median’,’min’,’max’,’n’]

  • For detail_level=2: 11 values:
    • [‘mean’,’sd’,’median’,’min’,’max’,’n’,’q25’,’q75’,’iqr’,’kur’,’skw’]

  • For detail_level=3: 13 values:
    • [‘mean’,’sd’,’median’,’min’,’max’,’n’,’q25’,’q75’,’iqr’,’kur’,’skw’,’gmean’,’entropy’]

name: str, default=’x’
  • name of the column in table

Returns:
S: 1d-array of values
stats_names: list of str,
  • names of stats

Sdf: pd DataFrame
  • Table of statistics

See also

quick_stats, outliers

Examples

>>> #sp.stats.get_stats
>>> import numpy as np
>>> import pandas as pd
>>> import spkit as sp
>>> x = np.random.randn(1000)
>>> S,names,df = sp.stats.get_stats(x,detail_level=1)
>>> print(df)
       mean        sd  median       min       max       n
x -0.029575  1.016306 -0.0001 -3.522644  2.942269  1000.0
>>> S,names,df = sp.stats.get_stats(x,detail_level=3)
>>> print(df)
        mean        sd  median       min       max       n       q25       q75      x -0.029575  1.016306 -0.0001 -3.522644  2.942269  1000.0 -0.726123  0.640879   
        iqr       kur       skw     gmean   entropy  
x  1.367002 -0.017887 -0.007691  0.530046  3.945704