issues: 1307501602
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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1307501602 | I_kwDOAMm_X85N7uQi | 6802 | Indexing via `sel`/`loc` fails on multiindex float coordinate | 57488425 | closed | 0 | 4 | 2022-07-18T07:10:15Z | 2022-07-18T16:25:34Z | 2022-07-18T15:51:47Z | NONE | What happened?When I generate a stacked multiindex coordinate dataset
The The problems seems to lie in What did you expect to happen?Expecting Minimal Complete Verifiable Example
MVCE confirmation
Relevant log output```Python Traceback (most recent call last): File "~/.miniconda3/envs/artiq/lib/python3.8/site-packages/pandas/core/indexes/base.py", line 3621, in get_loc return self._engine.get_loc(casted_key) File "pandas/_libs/index.pyx", line 136, in pandas._libs.index.IndexEngine.get_loc File "pandas/_libs/index.pyx", line 142, in pandas._libs.index.IndexEngine.get_loc TypeError: '1.2' is an invalid key During handling of the above exception, another exception occurred: Traceback (most recent call last): File "~/.miniconda3/envs/artiq/lib/python3.8/site-packages/spyder_kernels/py3compat.py", line 356, in compat_exec exec(code, globals, locals) File "~/data_import.py", line 65, in <module> xr.Dataset( File "~/.miniconda3/envs/artiq/lib/python3.8/site-packages/xarray/core/dataset.py", line 2501, in sel pos_indexers, new_indexes = remap_label_indexers( File "~/.miniconda3/envs/artiq/lib/python3.8/site-packages/xarray/core/coordinates.py", line 421, in remap_label_indexers pos_indexers, new_indexes = indexing.remap_label_indexers( File "~/.miniconda3/envs/artiq/lib/python3.8/site-packages/xarray/core/indexing.py", line 121, in remap_label_indexers idxr, new_idx = index.query(labels, method=method, tolerance=tolerance) File "~/.miniconda3/envs/artiq/lib/python3.8/site-packages/xarray/core/indexes.py", line 353, in query indexer, new_index = self.index.get_loc_level( File "~/.miniconda3/envs/artiq/lib/python3.8/site-packages/pandas/core/indexes/multi.py", line 2972, in get_loc_level loc, mi = self._get_loc_level(key, level=level) File "~/.miniconda3/envs/artiq/lib/python3.8/site-packages/pandas/core/indexes/multi.py", line 3005, in _get_loc_level loc, new_index = self._get_loc_level(k, level=lev) File "~/.miniconda3/envs/artiq/lib/python3.8/site-packages/pandas/core/indexes/multi.py", line 3113, in _get_loc_level indexer = self._get_level_indexer(key, level=level) File "~/.miniconda3/envs/artiq/lib/python3.8/site-packages/pandas/core/indexes/multi.py", line 3222, in _get_level_indexer idx = self._get_loc_single_level_index(level_index, key) File "~/.miniconda3/envs/artiq/lib/python3.8/site-packages/pandas/core/indexes/multi.py", line 2802, in _get_loc_single_level_index return level_index.get_loc(key) File "~/.miniconda3/envs/artiq/lib/python3.8/site-packages/pandas/core/indexes/base.py", line 3628, in get_loc self._check_indexing_error(key) File "~/.miniconda3/envs/artiq/lib/python3.8/site-packages/pandas/core/indexes/base.py", line 5637, in _check_indexing_error raise InvalidIndexError(key) InvalidIndexError: 1.2 ``` Anything else we need to know?No response Environment
INSTALLED VERSIONS
------------------
commit: None
python: 3.8.13 | packaged by conda-forge | (default, Mar 25 2022, 06:04:10)
[GCC 10.3.0]
python-bits: 64
OS: Linux
OS-release: 5.17.5-76051705-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: ('en_US', 'UTF-8')
libhdf5: 1.12.1
libnetcdf: 4.8.1
xarray: 2022.3.0
pandas: 1.4.3
numpy: 1.23.1
scipy: 1.8.1
netCDF4: 1.6.0
pydap: None
h5netcdf: 1.0.1
h5py: 3.7.0
Nio: None
zarr: 2.12.0
cftime: 1.6.1
nc_time_axis: None
PseudoNetCDF: None
rasterio: None
cfgrib: None
iris: None
bottleneck: None
dask: None
distributed: None
matplotlib: 3.5.2
cartopy: None
seaborn: None
numbagg: None
fsspec: None
cupy: None
pint: None
sparse: None
setuptools: 63.2.0
pip: 22.1.2
conda: None
pytest: None
IPython: 7.33.0
sphinx: 5.0.2
/home/thorsten/.miniconda3/envs/artiq/lib/python3.8/site-packages/_distutils_hack/__init__.py:33: UserWarning: Setuptools is replacing distutils.
warnings.warn("Setuptools is replacing distutils.")
|
{ "url": "https://api.github.com/repos/pydata/xarray/issues/6802/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
completed | 13221727 | issue |