Skip to main content

Module reduce

Module reduce 

Source
Expand description

Reductions along named axes, cumulative operations and differences.

Nulls are skipped, like the NumPy nan* functions. A group without valid values gives 0 for sums, 1 for products, false for any, true for all, 0 for counts and null for all other reductions. Floats order NaN above all numbers, like Arrow, so max can return NaN. Use nan_to_null to treat NaN as missing.

Enums§

Reduction
A reduction for reduce and groupby_reduce.

Functions§

all
true if all values are true (or non-zero), like numpy.all.
any
true if any value is true (or non-zero), like numpy.any.
argmax
Index of the first maximum, like numpy.nanargmax.
argmin
Index of the first minimum, like numpy.nanargmin.
count
Number of non-null values, like xarray.DataArray.count.
cummax
Running maximum along dim, like numpy.maximum.accumulate. Null positions stay null.
cummin
Running minimum along dim, like numpy.minimum.accumulate. Null positions stay null.
cumprod
Cumulative product along dim, like numpy.nancumprod. Null positions stay null.
cumsum
Cumulative sum along dim, like numpy.nancumsum. Null positions stay null.
diff
The n-th discrete difference along dim, like numpy.diff.
max
Maximum, like numpy.nanmax.
mean
Mean, like numpy.nanmean. Integers give Float64.
median
Median, like numpy.nanmedian.
min
Minimum, like numpy.nanmin.
prod
Product, like numpy.nanprod. Integers multiply as Int64 or UInt64, with wrapping.
ptp
Range of values (max - min), like numpy.ptp.
quantile
Quantile with linear interpolation, like numpy.nanquantile.
reduce
Reduce a over the named axes. None reduces all axes to a scalar.
std
Standard deviation, like numpy.nanstd.
sum
Sum, like numpy.nansum. Integers sum as Int64 or UInt64, with wrapping.
var
Variance, like numpy.nanvar.