9.2.5. Stats#

Statistical functions and helpers.

junifer.stats.count(data, axis=0)#

Count the number elements along the given axis.

Parameters:
datanumpy.ndarray

Data to count elements on.

axisint, optional

The axis to count elements on (default 0).

Returns:
numpy.ndarray

Number of elements along the given axis.

junifer.stats.get_aggfunc_by_name(name, func_params=None)#

Get an aggregation function by its name.

Parameters:
namestr

Name to identify the function. Currently supported names and corresponding functions are:

func_paramsdict, optional

Parameters to pass to the function. E.g. for winsorized_mean: func_params = {'limits': [0.1, 0.1]} (default None).

Returns:
function

Respective function with func_params parameter set.

junifer.stats.select(data, axis=0, pick=None, drop=None)#

Select a subset of the data.

Parameters:
datanumpy.ndarray

Data to select a subset from.

axisint, optional

The axis to select a subset from (default 0).

picklist of int, optional

List of indices to select (default None).

droplist of int, optional

List of indices to drop (default None).

Returns:
numpy.ndarray

Subset of the inputted data with the select settings applied as specified in select_params.

Raises:
ValueError

If both pick and drop are None or if both pick and drop are not None.

junifer.stats.winsorized_mean(data, axis=None, **win_params)#

Compute a winsorized mean by chaining winsorization and mean.

Parameters:
datanumpy.ndarray

Data to calculate winsorized mean on.

axisint, optional

The axis to calculate winsorized mean on (default None).

**win_paramsdict

Dictionary containing the keyword arguments for the winsorize function. E.g., {'limits': [0.1, 0.1]}.

Returns:
numpy.ndarray

Winsorized mean of the inputted data with the winsorize settings applied as specified in win_params.

See also

scipy.stats.mstats.winsorize

The winsorize function used in this function.