9.2.2. Stats¶
Statistical functions and helpers.
- enum junifer.stats.AggFunc(value)¶
Accepted aggregation function names.
mean->numpy.mean()winsorized_mean->scipy.stats.mstats.winsorize()trim_mean->scipy.stats.trim_mean()mode->scipy.stats.mode()std->numpy.std()count->count()select->select()
- Member Type:
Valid values are as follows:
- Mean = <AggFunc.Mean: 'mean'>¶
- WinsorizedMean = <AggFunc.WinsorizedMean: 'winsorized_mean'>¶
- TrimMean = <AggFunc.TrimMean: 'trim_mean'>¶
- Mode = <AggFunc.Mode: 'mode'>¶
- Std = <AggFunc.Std: 'std'>¶
- Count = <AggFunc.Count: 'count'>¶
- Select = <AggFunc.Select: 'select'>¶
- junifer.stats.count(data, axis=0)¶
Count the number elements along the given axis.
- Parameters:
- data
numpy.ndarray Data to count elements on.
- axis
int, optional The axis to count elements on (default 0).
- data
- Returns:
numpy.ndarrayNumber of elements along the given axis.
- junifer.stats.get_aggfunc_by_name(name, func_params=None)¶
Get an aggregation function by its name.
- junifer.stats.select(data, axis=0, pick=None, drop=None)¶
Select a subset of the data.
- Parameters:
- Returns:
numpy.ndarraySubset of the inputted data with the select settings applied as specified in
select_params.
- Raises:
ValueErrorIf both
pickanddropare None or if bothpickanddropare not None.
- junifer.stats.winsorized_mean(data, axis=None, **win_params)¶
Compute a winsorized mean by chaining winsorization and mean.
- Parameters:
- data
numpy.ndarray Data to calculate winsorized mean on.
- axis
int, optional The axis to calculate winsorized mean on (default None).
- **win_params
dict Dictionary containing the keyword arguments for the winsorize function. E.g.,
{'limits': [0.1, 0.1]}.
- data
- Returns:
numpy.ndarrayWinsorized mean of the inputted data with the winsorize settings applied as specified in
win_params.
See also
scipy.stats.mstats.winsorizeThe winsorize function used in this function.