Skip to content

Commit ca72d56

Browse files
Make kind argument in CFTimeIndex._maybe_cast_slice_bound optional (#5359)
* [test-upstream] Make kind argument in CFTimeIndex._maybe_cast_slice_bound optional * Update doc/whats-new.rst Co-authored-by: keewis <[email protected]> Co-authored-by: keewis <[email protected]>
1 parent 35b805f commit ca72d56

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

doc/whats-new.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ 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`).
39+
By `Spencer Clark <https://github.com/spencerkclark>`_.
3640

3741

3842
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)