9.2.5. Stats#
Provide functions for statistics.
- 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.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:
- name
str
Name to identify the function. Currently supported names and corresponding functions are:
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()
- func_params
dict
, optional Parameters to pass to the function. E.g. for
winsorized_mean
:func_params = {'limits': [0.1, 0.1]}
(default None).
- name
- 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:
- Returns:
numpy.ndarray
Subset of the inputted data with the select settings applied as specified in
select_params
.
- Raises:
ValueError
If both
pick
anddrop
are None or if bothpick
anddrop
are 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.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.