Skip to content
forked from pydata/xarray

Commit

Permalink
Merge branch 'master' into fix/groupby-nan
Browse files Browse the repository at this point in the history
  • Loading branch information
dcherian authored Oct 17, 2019
2 parents 1c751a6 + 1f81338 commit cfe87e0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
8 changes: 8 additions & 0 deletions doc/whats-new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ Bug fixes

- Fix grouping over variables with NaNs. (:issue:`2383`, :pull:`3406`).
By `Deepak Cherian <https://github.com/dcherian>`_.

Documentation
~~~~~~~~~~~~~

- Fix the documentation of :py:meth:`DataArray.resample` and
:py:meth:`Dataset.resample` and explicitly state that a
datetime-like dimension is required. (:pull:`3400`)
By `Justus Magin <https://github.com/keewis>`_.

.. _whats-new.0.14.0:

Expand Down
15 changes: 12 additions & 3 deletions xarray/core/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -914,13 +914,16 @@ def resample(
):
"""Returns a Resample object for performing resampling operations.
Handles both downsampling and upsampling. If any intervals contain no
values from the original object, they will be given the value ``NaN``.
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 : {dim: freq}, optional
Mapping from the dimension name to resample frequency.
Mapping from the dimension name to resample frequency. The
dimension must be datetime-like.
skipna : bool, optional
Whether to skip missing values when aggregating in downsampling.
closed : 'left' or 'right', optional
Expand Down Expand Up @@ -978,12 +981,18 @@ def resample(
* time (time) datetime64[ns] 1999-12-15 1999-12-16 1999-12-17 ...
Limit scope of upsampling method
>>> da.resample(time='1D').nearest(tolerance='1D')
<xarray.DataArray (time: 337)>
array([ 0., 0., nan, ..., nan, 11., 11.])
Coordinates:
* time (time) datetime64[ns] 1999-12-15 1999-12-16 ... 2000-11-15
See Also
--------
pandas.Series.resample
pandas.DataFrame.resample
References
----------
Expand Down

0 comments on commit cfe87e0

Please sign in to comment.