bundles / scipy latest / scipy / stats / _axis_nan_policy / _axis_nan_policy_factory
function
scipy.stats._axis_nan_policy:_axis_nan_policy_factory
Signature
def _axis_nan_policy_factory ( tuple_to_result , default_axis = 0 , n_samples = 1 , paired = False , result_to_tuple = None , too_small = 0 , n_outputs = 2 , kwd_samples = () , override = None ) Summary
Factory for a wrapper that adds axis/nan_policy params to a function.
Parameters
tuple_to_result: callableCallable that returns an object of the type returned by the function being wrapped (e.g. the namedtuple or dataclass returned by a statistical test) provided the separate components (e.g. statistic, pvalue).
default_axis: int, default: 0The default value of the axis argument. Standard is 0 except when backwards compatibility demands otherwise (e.g.
None).n_samples: int or callable, default: 1The number of data samples accepted by the function (e.g.
mannwhitneyu), a callable that accepts a dictionary of parameters passed into the function and returns the number of data samples (e.g.wilcoxon), orNoneto indicate an arbitrary number of samples (e.g.kruskal).paired: {False, True}Whether the function being wrapped treats the samples as paired (i.e. corresponding elements of each sample should be considered as different components of the same sample.)
result_to_tuple: callable, optionalFunction that unpacks the results of the function being wrapped into a tuple. This is essentially the inverse of
tuple_to_result. Default isNone, which is appropriate for statistical tests that return a statistic, pvalue tuple (rather than, e.g., a non-iterable datalass).too_small: int or callable, default: 0The largest unnacceptably small sample for the function being wrapped. For example, some functions require samples of size two or more or they raise an error. This argument prevents the error from being raised when input is not 1D and instead places a NaN in the corresponding element of the result. If callable, it must accept a list of samples, axis, and a dictionary of keyword arguments passed to the wrapper function as arguments and return a bool indicating weather the samples passed are too small.
n_outputs: int or callable, default: 2The number of outputs produced by the function given 1d sample(s). For example, hypothesis tests that return a namedtuple or result object with attributes
statisticandpvalueuse the defaultn_outputs=2; summary statistics with scalar output usen_outputs=1. Alternatively, may be a callable that accepts a dictionary of arguments passed into the wrapped function and returns the number of outputs corresponding with those arguments.kwd_samples: sequence, default: ()The names of keyword parameters that should be treated as samples. For example, gmean accepts as its first argument a sample
abut alsoweightsas a fourth, optional keyword argument. In this case, we usen_samples=1and kwd_samples=['weights'].override: dict, default: {'vectorization': False, 'nan_propagation': True}Pass a dictionary with
'vectorization': Trueto ensure that the decorator overrides the function's behavior for multimensional input. Use'nan_propagation': Falseto ensure that the decorator does not override the function's behavior fornan_policy='propagate'.
Aliases
-
scipy.stats._axis_nan_policy._axis_nan_policy_factory