Skip to content

Commit

Permalink
[test-upstream] Make kind argument in CFTimeIndex._maybe_cast_slice_b…
Browse files Browse the repository at this point in the history
…ound optional
  • Loading branch information
spencerkclark committed May 21, 2021
1 parent 84429bf commit 591263e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
3 changes: 3 additions & 0 deletions doc/whats-new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ Deprecations

Bug fixes
~~~~~~~~~
- Fix a minor incompatibility between partial datetime string indexing with a
:py:class:`CFTimeIndex` and upcoming pandas version 1.3.0 (:issue:`5356`,
:pull:`5359`). By `Spencer Clark <https://github.com/spencerkclark>`_.


Documentation
Expand Down
9 changes: 7 additions & 2 deletions xarray/coding/cftimeindex.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,9 +465,14 @@ def get_loc(self, key, method=None, tolerance=None):
else:
return pd.Index.get_loc(self, key, method=method, tolerance=tolerance)

def _maybe_cast_slice_bound(self, label, side, kind):
def _maybe_cast_slice_bound(self, label, side, kind=None):
"""Adapted from
pandas.tseries.index.DatetimeIndex._maybe_cast_slice_bound"""
pandas.tseries.index.DatetimeIndex._maybe_cast_slice_bound
Note that we have never used the kind argument in CFTimeIndex and it is
deprecated as of pandas version 1.3.0. It exists only for compatibility
reasons. We can remove it when our minimum version of pandas is 1.3.0.
"""
if not isinstance(label, str):
return label

Expand Down

0 comments on commit 591263e

Please sign in to comment.