You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The `.sel` operation produces a KeyError in `pandas/core/indexes/datetimes.py`:
Traceback (most recent call last):
File "datetime_problem.py", line 11, in
ds.sel(dates=ds.dates.values[2])
File "/Users/leifdenby/miniconda3/envs/lagtraj/lib/python3.8/site-packages/xarray/core/dataset.py", line 2101, in sel
pos_indexers, new_indexes = remap_label_indexers(
File "/Users/leifdenby/miniconda3/envs/lagtraj/lib/python3.8/site-packages/xarray/core/coordinates.py", line 396, in remap_label_indexers
pos_indexers, new_indexes = indexing.remap_label_indexers(
File "/Users/leifdenby/miniconda3/envs/lagtraj/lib/python3.8/site-packages/xarray/core/indexing.py", line 270, in remap_label_indexers
idxr, new_idx = convert_label_indexer(index, label, dim, method, tolerance)
File "/Users/leifdenby/miniconda3/envs/lagtraj/lib/python3.8/site-packages/xarray/core/indexing.py", line 189, in convert_label_indexer
indexer = index.get_loc(
File "/Users/leifdenby/miniconda3/envs/lagtraj/lib/python3.8/site-packages/pandas/core/indexes/datetimes.py", line 622, in get_loc
raise KeyError(key)
KeyError: 946857600000000000
Apologies if this is a know issue. I tried to work out whether this is an issue with pandas or xarray (I assume it is with pandas), but couldn't find the right piece of code. Happy to fix the issue if someone could show me what needs to change.
The text was updated successfully, but these errors were encountered:
Code below works with
pandas<=1.0.5
and is broken with the most recent version (pandas==1.1.0
) independent of xarray version (tried0.16.0
and0.15.0
)The `.sel` operation produces a KeyError in `pandas/core/indexes/datetimes.py`:
Environment:
Output of xr.show_versions()
INSTALLED VERSIONS ------------------ commit: None python: 3.8.5 | packaged by conda-forge | (default, Jul 24 2020, 01:06:20) [Clang 10.0.1 ] python-bits: 64 OS: Darwin OS-release: 18.0.0 machine: x86_64 processor: i386 byteorder: little LC_ALL: en_GB.UTF-8 LANG: None LOCALE: en_GB.UTF-8 libhdf5: 1.10.5 libnetcdf: 4.6.3xarray: 0.16.0
pandas: 1.1.0
numpy: 1.19.1
scipy: 1.5.2
netCDF4: 1.5.4
pydap: None
h5netcdf: None
h5py: None
Nio: None
zarr: None
cftime: 1.2.1
nc_time_axis: None
PseudoNetCDF: None
rasterio: None
cfgrib: None
iris: None
bottleneck: None
dask: 2.22.0
distributed: None
matplotlib: 3.3.0
cartopy: None
seaborn: None
numbagg: None
pint: None
setuptools: 49.2.0.post20200712
pip: 20.1.1
conda: None
pytest: 6.0.1
IPython: 7.16.1
sphinx: None
Apologies if this is a know issue. I tried to work out whether this is an issue with pandas or xarray (I assume it is with pandas), but couldn't find the right piece of code. Happy to fix the issue if someone could show me what needs to change.
The text was updated successfully, but these errors were encountered: