pyinterp.DescriptiveStatistics

class pyinterp.DescriptiveStatistics(values: Union[dask.array.core.Array, numpy.ndarray], weights: Optional[Union[dask.array.core.Array, numpy.ndarray]] = None, axis: Optional[Union[int, Iterable[int]]] = None, dtype: Optional[numpy.dtype] = None)[source]

Bases: object

Univariate descriptive statistics.

Calculates the incremental descriptive statistics from the provided values. The calculation of the statistics is done when the constructor is invoked. Different methods allow to extract the calculated statistics.

See also

Pébay, P., Terriberry, T.B., Kolla, H. et al. Numerically stable, scalable formulas for parallel and online computation of higher-order multivariate central moments with arbitrary weights. Comput Stat 31, 1305–1325, 2016, https://doi.org/10.1007/s00180-015-0637-z

__init__(values: Union[dask.array.core.Array, numpy.ndarray], weights: Optional[Union[dask.array.core.Array, numpy.ndarray]] = None, axis: Optional[Union[int, Iterable[int]]] = None, dtype: Optional[numpy.dtype] = None) None[source]

Creates a new descriptive statistics container.

Parameters
  • values (numpy.ndarray, dask.Array) –

    Array containing numbers whose statistics are desired.

    Note

    NaNs are automatically ignored.

  • weights (numpy.ndarray, dask.Array, optional) – An array of weights associated with the values. If not provided, all values are assumed to have equal weight.

  • axis (int, iterable, optional) – Axis or axes along which to compute the statistics. If not provided, the statistics are computed over the flattened array.

  • dtype (numpy.dtype, optional) – Data type of the returned array. By default, the data type is numpy.float64.

Methods

DescriptiveStatistics.array()

Returns the different statistical variables calculated in a numpy structured table with the following fields:

DescriptiveStatistics.count()

Returns the count of samples.

DescriptiveStatistics.kurtosis()

Returns the kurtosis of samples.

DescriptiveStatistics.max()

Returns the maximum of samples.

DescriptiveStatistics.mean()

Returns the mean of samples.

DescriptiveStatistics.min()

Returns the minimum of samples.

DescriptiveStatistics.skewness()

Returns the skewness of samples.

DescriptiveStatistics.std([ddof])

Returns the standard deviation of samples.

DescriptiveStatistics.sum()

Returns the sum of samples.

DescriptiveStatistics.sum_of_weights()

Returns the sum of weights.

DescriptiveStatistics.var([ddof])

Returns the variance of samples.

DescriptiveStatistics.__iadd__(other)

Adds a new descriptive statistics container to the current one.

DescriptiveStatistics.__str__()

Return str(self).