Reduce this NamedArray'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,
**kwargs: Any,
)
| 378 | ) |
| 379 | |
| 380 | def prod( |
| 381 | self, |
| 382 | dim: Dims = None, |
| 383 | *, |
| 384 | skipna: bool | None = None, |
| 385 | min_count: int | None = None, |
| 386 | **kwargs: Any, |
| 387 | ) -> Self: |
| 388 | """ |
| 389 | Reduce this NamedArray's data by applying ``prod`` along some dimension(s). |
| 390 | |
| 391 | Parameters |
| 392 | ---------- |
| 393 | dim : str, Iterable of Hashable, "..." or None, default: None |
| 394 | Name of dimension[s] along which to apply ``prod``. For e.g. ``dim="x"`` |
| 395 | or ``dim=["x", "y"]``. If "..." or None, will reduce over all dimensions. |
| 396 | skipna : bool or None, optional |
| 397 | If True, skip missing values (as marked by NaN). By default, only |
| 398 | skips missing values for float dtypes; other dtypes either do not |
| 399 | have a sentinel missing value (int) or ``skipna=True`` has not been |
| 400 | implemented (object, datetime64 or timedelta64). |
| 401 | min_count : int or None, optional |
| 402 | The required number of valid values to perform the operation. If |
| 403 | fewer than min_count non-NA values are present the result will be |
| 404 | NA. Only used if skipna is set to True or defaults to True for the |
| 405 | array's dtype. Changed in version 0.17.0: if specified on an integer |
| 406 | array and skipna=True, the result will be a float array. |
| 407 | **kwargs : Any |
| 408 | Additional keyword arguments passed on to the appropriate array |
| 409 | function for calculating ``prod`` on this object's data. |
| 410 | These could include dask-specific kwargs like ``split_every``. |
| 411 | |
| 412 | Returns |
| 413 | ------- |
| 414 | reduced : NamedArray |
| 415 | New NamedArray with ``prod`` applied to its data and the |
| 416 | indicated dimension(s) removed |
| 417 | |
| 418 | See Also |
| 419 | -------- |
| 420 | numpy.prod |
| 421 | dask.array.prod |
| 422 | Dataset.prod |
| 423 | DataArray.prod |
| 424 | :ref:`agg` |
| 425 | User guide on reduction or aggregation operations. |
| 426 | |
| 427 | Notes |
| 428 | ----- |
| 429 | Non-numeric variables will be removed prior to reducing. |
| 430 | |
| 431 | Examples |
| 432 | -------- |
| 433 | >>> from xarray.namedarray.core import NamedArray |
| 434 | >>> na = NamedArray("x", np.array([1, 2, 3, 0, 2, np.nan])) |
| 435 | >>> na |
| 436 | <xarray.NamedArray (x: 6)> Size: 48B |
| 437 | array([ 1., 2., 3., 0., 2., nan]) |