- DataArrayWeighted.quantile(q, *, dim=None, keep_attrs=None, skipna=True)#
Apply a weighted
quantileto this Dataset’s data along some dimension(s).
Weights are interpreted as sampling weights (or probability weights) and describe how a sample is scaled to the whole population . There are other possible interpretations for weights, precision weights describing the precision of observations, or frequency weights counting the number of identical observations, however, they are not implemented here.
For compatibility with NumPy’s non-weighted
quantile(which is used by
Dataset.quantile), the only interpolation method supported by this weighted version corresponds to the default “linear” option of
numpy.quantile. This is “Type 7” option, described in Hyndman and Fan (1996) . The implementation is largely inspired by a blog post from A. Akinshin’s .
bool, optional) – If True, skip missing values (as marked by NaN). By default, only skips missing values for float dtypes; other dtypes either do not have a sentinel missing value (int) or skipna=True has not been implemented (object, datetime64 or timedelta64).
bool, optional) – If True, the attributes (
attrs) will be copied from the original object to the new one. If False (default), the new object will be returned without attributes.
Dataset) – New Dataset object with weighted
quantileapplied to its data and the indicated dimension(s) removed.
Returns NaN if the
weightssum to 0.0 along the reduced dimension(s).