# combo: Statistics combo functions¶

This module provides combination of statistics as single operation.

For now it provides min/max (and optionally positive min) and indices of first occurrences (i.e., argmin/argmax) in a single pass.

min_max(data, bool min_positive=False, bool finite=False)

Returns min, max and optionally strictly positive min of data.

It also computes the indices of first occurrence of min/max.

NaNs are ignored while computing min/max unless all data is NaNs, in which case returned min/max are NaNs.

The result data type is that of the input data, except for the following cases. For input using non-native bytes order, the result is returned as native floating-point or integers. For input using 16-bits floating-point, the result is returned as 32-bits floating-point.

Examples:

>>> import numpy
>>> data = numpy.arange(10)


Usage as a function returning min and max:

>>> min_, max_ = min_max(data)


Usage as a function returning a result object to access all information:

>>> result = min_max(data)  # Do not get positive min
>>> result.minimum, result.argmin
0, 0
>>> result.maximum, result.argmax
9, 10
>>> result.min_positive, result.argmin_positive  # Not computed
None, None


Getting strictly positive min information:

>>> result = min_max(data, min_positive=True)
>>> result.min_positive, result.argmin_positive  # Computed
1, 1


If finite is True, min/max information is computed only from finite data. Then, all result fields (include minimum and maximum) can be None when all data is infinity or NaN.

Parameters: data – Array-like dataset min_positive (bool) – True to compute the positive min and argmin Default: False. finite (bool) – True to compute min/max from finite data only Default: False. An object with minimum, maximum and min_positive attributes and the indices of first occurrence in the flattened data: argmin, argmax and argmin_positive attributes. If all data is <= 0 or min_positive argument is False, then min_positive and argmin_positive are None. ValueError if data is empty