Skip to content

Commit 591263e

Browse files
committed
[test-upstream] Make kind argument in CFTimeIndex._maybe_cast_slice_bound optional
1 parent 84429bf commit 591263e

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

doc/whats-new.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ Deprecations
3333

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

3740

3841
Documentation

xarray/coding/cftimeindex.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -465,9 +465,14 @@ def get_loc(self, key, method=None, tolerance=None):
465465
else:
466466
return pd.Index.get_loc(self, key, method=method, tolerance=tolerance)
467467

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

0 commit comments

Comments
 (0)