MCPcopy Create free account
hub / github.com/pydata/xarray / prod

Method prod

xarray/core/_aggregations.py:7412–7535  ·  view source on GitHub ↗

Reduce this DataArray's data by applying ``prod`` along some dimension(s). Parameters ---------- dim : str, Iterable of Hashable, "..." or None, default: None Name of dimension[s] along which to apply ``prod``. For e.g. ``dim="x"`` or ``dim=[

(
        self,
        dim: Dims = None,
        *,
        skipna: bool | None = None,
        min_count: int | None = None,
        keep_attrs: bool | None = None,
        **kwargs: Any,
    )

Source from the content-addressed store, hash-verified

7410 return out
7411
7412 def prod(
7413 self,
7414 dim: Dims = None,
7415 *,
7416 skipna: bool | None = None,
7417 min_count: int | None = None,
7418 keep_attrs: bool | None = None,
7419 **kwargs: Any,
7420 ) -> DataArray:
7421 """
7422 Reduce this DataArray's data by applying ``prod`` along some dimension(s).
7423
7424 Parameters
7425 ----------
7426 dim : str, Iterable of Hashable, "..." or None, default: None
7427 Name of dimension[s] along which to apply ``prod``. For e.g. ``dim="x"``
7428 or ``dim=["x", "y"]``. If None, will reduce over the GroupBy dimensions.
7429 If "...", will reduce over all dimensions.
7430 skipna : bool or None, optional
7431 If True, skip missing values (as marked by NaN). By default, only
7432 skips missing values for float dtypes; other dtypes either do not
7433 have a sentinel missing value (int) or ``skipna=True`` has not been
7434 implemented (object, datetime64 or timedelta64).
7435 min_count : int or None, optional
7436 The required number of valid values to perform the operation. If
7437 fewer than min_count non-NA values are present the result will be
7438 NA. Only used if skipna is set to True or defaults to True for the
7439 array's dtype. Changed in version 0.17.0: if specified on an integer
7440 array and skipna=True, the result will be a float array.
7441 keep_attrs : bool or None, optional
7442 If True, ``attrs`` will be copied from the original
7443 object to the new one. If False, the new object will be
7444 returned without attributes.
7445 **kwargs : Any
7446 Additional keyword arguments passed on to the appropriate array
7447 function for calculating ``prod`` on this object's data.
7448 These could include dask-specific kwargs like ``split_every``.
7449
7450 Returns
7451 -------
7452 reduced : DataArray
7453 New DataArray with ``prod`` applied to its data and the
7454 indicated dimension(s) removed
7455
7456 See Also
7457 --------
7458 numpy.prod
7459 dask.array.prod
7460 DataArray.prod
7461 :ref:`groupby`
7462 User guide on groupby operations.
7463
7464 Notes
7465 -----
7466 Use the ``flox`` package to significantly speed up groupby computations,
7467 especially with dask arrays. Xarray will use flox by default if installed.
7468 Pass flox-specific keyword arguments in ``**kwargs``.
7469 See the `flox documentation <https://flox.readthedocs.io>`_ for more.

Callers

nothing calls this directly

Calls 3

_flox_reduceMethod · 0.95
reduceMethod · 0.95

Tested by

no test coverage detected