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

Method resample

xarray/core/dataset.py:10499–10577  ·  view source on GitHub ↗

Returns a Resample object for performing resampling operations. Handles both downsampling and upsampling. The resampled dimension must be a datetime-like coordinate. If any intervals contain no values from the original object, they will be given the value ``NaN``.

(
        self,
        indexer: Mapping[Any, ResampleCompatible | Resampler] | None = None,
        *,
        skipna: bool | None = None,
        closed: SideOptions | None = None,
        label: SideOptions | None = None,
        offset: pd.Timedelta | datetime.timedelta | str | None = None,
        origin: str | DatetimeLike = "start_day",
        restore_coord_dims: bool | None = None,
        **indexer_kwargs: ResampleCompatible | Resampler,
    )

Source from the content-addressed store, hash-verified

10497
10498 @_deprecate_positional_args("v2024.07.0")
10499 def resample(
10500 self,
10501 indexer: Mapping[Any, ResampleCompatible | Resampler] | None = None,
10502 *,
10503 skipna: bool | None = None,
10504 closed: SideOptions | None = None,
10505 label: SideOptions | None = None,
10506 offset: pd.Timedelta | datetime.timedelta | str | None = None,
10507 origin: str | DatetimeLike = "start_day",
10508 restore_coord_dims: bool | None = None,
10509 **indexer_kwargs: ResampleCompatible | Resampler,
10510 ) -> DatasetResample:
10511 """Returns a Resample object for performing resampling operations.
10512
10513 Handles both downsampling and upsampling. The resampled
10514 dimension must be a datetime-like coordinate. If any intervals
10515 contain no values from the original object, they will be given
10516 the value ``NaN``.
10517
10518 Parameters
10519 ----------
10520 indexer : Mapping of Hashable to str, datetime.timedelta, pd.Timedelta, pd.DateOffset, or Resampler, optional
10521 Mapping from the dimension name to resample frequency [1]_. The
10522 dimension must be datetime-like.
10523 skipna : bool, optional
10524 Whether to skip missing values when aggregating in downsampling.
10525 closed : {"left", "right"}, optional
10526 Side of each interval to treat as closed.
10527 label : {"left", "right"}, optional
10528 Side of each interval to use for labeling.
10529 origin : {'epoch', 'start', 'start_day', 'end', 'end_day'}, pd.Timestamp, datetime.datetime, np.datetime64, or cftime.datetime, default 'start_day'
10530 The datetime on which to adjust the grouping. The timezone of origin
10531 must match the timezone of the index.
10532
10533 If a datetime is not used, these values are also supported:
10534 - 'epoch': `origin` is 1970-01-01
10535 - 'start': `origin` is the first value of the timeseries
10536 - 'start_day': `origin` is the first day at midnight of the timeseries
10537 - 'end': `origin` is the last value of the timeseries
10538 - 'end_day': `origin` is the ceiling midnight of the last day
10539 offset : pd.Timedelta, datetime.timedelta, or str, default is None
10540 An offset timedelta added to the origin.
10541 restore_coord_dims : bool, optional
10542 If True, also restore the dimension order of multi-dimensional
10543 coordinates.
10544 **indexer_kwargs : str, datetime.timedelta, pd.Timedelta, pd.DateOffset, or Resampler
10545 The keyword arguments form of ``indexer``.
10546 One of indexer or indexer_kwargs must be provided.
10547
10548 Returns
10549 -------
10550 resampled : core.resample.DataArrayResample
10551 This object resampled.
10552
10553 See Also
10554 --------
10555 DataArray.resample
10556 pandas.Series.resample

Calls 1

_resampleMethod · 0.80