issues: 975385095
This data as json
id | node_id | number | title | user | state | locked | assignee | milestone | comments | created_at | updated_at | closed_at | author_association | active_lock_reason | draft | pull_request | body | reactions | performed_via_github_app | state_reason | repo | type |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
975385095 | MDU6SXNzdWU5NzUzODUwOTU= | 5721 | pandas deprecates Index.get_loc with method | 10194086 | closed | 0 | 7 | 2021-08-20T08:24:16Z | 2022-01-27T21:06:40Z | 2022-01-27T21:06:40Z | MEMBER | pandas deprecates the
We should fix this before pandas releases because the warning will not be silent (
We use this here:
https://github.com/pydata/xarray/blob/4bb9d9c6df77137f05e85c7cc6508fe7a93dc0e4/xarray/core/indexes.py#L233-L235
Is this only ever called with one item? Then we might be able to use
```python
indexer = self.index.get_indexer(
[label_value], method=method, tolerance=tolerance
).item()
if indexer == -1:
raise KeyError(label_value)
```
---
https://github.com/pydata/xarray/blob/3956b73a7792f41e4410349f2c40b9a9a80decd2/xarray/core/missing.py#L571-L572
This one could be easy to fix (replace with `imin = index.get_indexer([minval], method="nearest").item()`)
---
It is also defined in `CFTimeIndex`, which complicates things:
https://github.com/pydata/xarray/blob/eea76733770be03e78a0834803291659136bca31/xarray/coding/cftimeindex.py#L461-L466
because `get_indexer` expects an iterable and thus the `if isinstance(key, str)` test no longer works.
@benbovy @spencerkclark |
{ "url": "https://api.github.com/repos/pydata/xarray/issues/5721/reactions", "total_count": 1, "+1": 1, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
completed | 13221727 | issue |