home / github / issue_comments

Menu
  • GraphQL API
  • Search all tables

issue_comments: 682435326

This data as json

html_url issue_url id node_id user created_at updated_at author_association body reactions performed_via_github_app issue
https://github.com/pydata/xarray/issues/1240#issuecomment-682435326 https://api.github.com/repos/pydata/xarray/issues/1240 682435326 MDEyOklzc3VlQ29tbWVudDY4MjQzNTMyNg== 500246 2020-08-28T09:48:18Z 2020-08-28T09:48:56Z CONTRIBUTOR

I fixed my conda environment now (something was wrong as I appeared to have two xarray installations in parallel). I still get the KeyError with latest xarray master and latest pandas master:

$ conda list | egrep -w '(pandas|xarray)' pandas 1.2.0.dev0+167.g1f35b0621 pypi_0 pypi xarray 0.16.1.dev65+g13caf96e pypi_0 pypi $ python mwe83.py Traceback (most recent call last): File "mwe83.py", line 5, in <module> da.sel(time=da.coords["time"][0]) File "/data/gholl/miniconda3/envs/py38/lib/python3.8/site-packages/xarray/core/dataarray.py", line 1142, in sel ds = self._to_temp_dataset().sel( File "/data/gholl/miniconda3/envs/py38/lib/python3.8/site-packages/xarray/core/dataset.py", line 2096, in sel pos_indexers, new_indexes = remap_label_indexers( File "/data/gholl/miniconda3/envs/py38/lib/python3.8/site-packages/xarray/core/coordinates.py", line 395, in remap_label_indexers pos_indexers, new_indexes = indexing.remap_label_indexers( File "/data/gholl/miniconda3/envs/py38/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 "/data/gholl/miniconda3/envs/py38/lib/python3.8/site-packages/xarray/core/indexing.py", line 189, in convert_label_indexer indexer = index.get_loc( File "/data/gholl/miniconda3/envs/py38/lib/python3.8/site-packages/pandas/core/indexes/datetimes.py", line 622, in get_loc raise KeyError(key) KeyError: 0 $ cat mwe83.py import xarray as xr import numpy as np da = xr.DataArray([0, 1], dims=("time",), coords={"time": np.array([0, 1], dtype="M8[s]")}) da.sel(time=slice(da.coords["time"][0], da.coords["time"][1])) da.sel(time=da.coords["time"][0])

Oops, by "already have" you meant it's already been reported, I thought you meant it had already been fixed. All clear then.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  204071440
Powered by Datasette · Queries took 0.596ms · About: xarray-datasette