xarray.Dataset.resample#

Dataset.resample(indexer=None, skipna=None, closed=None, label=None, base=0, keep_attrs=None, loffset=None, restore_coord_dims=None, **indexer_kwargs)[source]#

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.

Parameters
  • indexer (Mapping of Hashable to str, optional) – Mapping from the dimension name to resample frequency 1. The dimension must be datetime-like.

  • skipna (bool, optional) – Whether to skip missing values when aggregating in downsampling.

  • closed ({"left", "right"}, optional) – Side of each interval to treat as closed.

  • label ({"left", "right"}, optional) – Side of each interval to use for labeling.

  • base (int, default = 0) – For frequencies that evenly subdivide 1 day, the “origin” of the aggregated intervals. For example, for “24H” frequency, base could range from 0 through 23.

  • loffset (timedelta or str, optional) – Offset used to adjust the resampled time labels. Some pandas date offset strings are supported.

  • restore_coord_dims (bool, optional) – If True, also restore the dimension order of multi-dimensional coordinates.

  • **indexer_kwargs (str) – The keyword arguments form of indexer. One of indexer or indexer_kwargs must be provided.

Returns

resampled (core.resample.DataArrayResample) – This object resampled.

References

1

http://pandas.pydata.org/pandas-docs/stable/timeseries.html#offset-aliases