MCPcopy
hub / github.com/pydata/xarray / quantile

Method quantile

xarray/core/groupby.py:1285–1436  ·  view source on GitHub ↗

Compute the qth quantile over each array in the groups and concatenate them together into a new array. Parameters ---------- q : float or sequence of float Quantile to compute, which must be between 0 and 1 inclusive. dim : str or Iter

(
        self,
        q: ArrayLike,
        dim: Dims = None,
        *,
        method: QuantileMethods = "linear",
        keep_attrs: bool | None = None,
        skipna: bool | None = None,
        interpolation: QuantileMethods | None = None,
    )

Source from the content-addressed store, hash-verified

1283 return ops.fillna(self, value)
1284
1285 def quantile(
1286 self,
1287 q: ArrayLike,
1288 dim: Dims = None,
1289 *,
1290 method: QuantileMethods = "linear",
1291 keep_attrs: bool | None = None,
1292 skipna: bool | None = None,
1293 interpolation: QuantileMethods | None = None,
1294 ) -> T_Xarray:
1295 """Compute the qth quantile over each array in the groups and
1296 concatenate them together into a new array.
1297
1298 Parameters
1299 ----------
1300 q : float or sequence of float
1301 Quantile to compute, which must be between 0 and 1
1302 inclusive.
1303 dim : str or Iterable of Hashable, optional
1304 Dimension(s) over which to apply quantile.
1305 Defaults to the grouped dimension.
1306 method : str, default: "linear"
1307 This optional parameter specifies the interpolation method to use when the
1308 desired quantile lies between two data points. The options sorted by their R
1309 type as summarized in the H&F paper [1]_ are:
1310
1311 1. "inverted_cdf"
1312 2. "averaged_inverted_cdf"
1313 3. "closest_observation"
1314 4. "interpolated_inverted_cdf"
1315 5. "hazen"
1316 6. "weibull"
1317 7. "linear" (default)
1318 8. "median_unbiased"
1319 9. "normal_unbiased"
1320
1321 The first three methods are discontiuous. The following discontinuous
1322 variations of the default "linear" (7.) option are also available:
1323
1324 * "lower"
1325 * "higher"
1326 * "midpoint"
1327 * "nearest"
1328
1329 See :py:func:`numpy.quantile` or [1]_ for details. The "method" argument
1330 was previously called "interpolation", renamed in accordance with numpy
1331 version 1.22.0.
1332 keep_attrs : bool or None, default: None
1333 If True, the dataarray's attributes (`attrs`) will be copied from
1334 the original object to the new one. If False, the new
1335 object will be returned without attributes.
1336 skipna : bool or None, default: None
1337 If True, skip missing values (as marked by NaN). By default, only
1338 skips missing values for float dtypes; other dtypes either do not
1339 have a sentinel missing value (int) or skipna=True has not been
1340 implemented (object, datetime64 or timedelta64).
1341
1342 Returns

Callers

nothing calls this directly

Calls 4

_flox_reduceMethod · 0.95
mapMethod · 0.95
module_availableFunction · 0.90

Tested by

no test coverage detected