Open scottyhq opened 1 year ago
Thanks we definitely want everything that works for sel
to work for drop_sel
.
index.get_indexer(labels_for_dim)
will get you the correct indices to drop. Though probably there's another method that could work.
cc @benbovy
What happened?
for a dataframe with a detailed timestamp coordinate (
2022-03-11T13:50:50.551314000
)da.sel(time="2022-03-11")
works but da.drop_sel(time="2022-03-11") results in aKeyError
What did you expect to happen?
i expect
drop_sel()
to work with the same inputs assel()
Minimal Complete Verifiable Example
A workaround is to use the exact datestring:
MVCE confirmation
Relevant log output
Anything else we need to know?
related to https://github.com/pydata/xarray/issues/6605#issuecomment-1126139617
Environment
(xarray: 2023.3.0)