issues: 937160239
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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
937160239 | MDU6SXNzdWU5MzcxNjAyMzk= | 5576 | Slicing bug with pandas 1.3 and CFTimeIndex | 81219 | closed | 0 | 2 | 2021-07-05T14:44:17Z | 2021-07-05T16:50:30Z | 2021-07-05T16:50:30Z | CONTRIBUTOR | What happened: Slicing into a DataArray along time with a CFTimeIndex fails since upgrade to pandas 1.3 What you expected to happen: The usual. Minimal Complete Verifiable Example:
```pythonTypeError Traceback (most recent call last) <ipython-input-5-3afe7d577940> in <module> ----> 1 ref.sel(time=slice(None, "2015-01-01")) ~/.conda/envs/xclim/lib/python3.8/site-packages/xarray/core/dataarray.py in sel(self, indexers, method, tolerance, drop, **indexers_kwargs) 1269 Dimensions without coordinates: points 1270 """ -> 1271 ds = self._to_temp_dataset().sel( 1272 indexers=indexers, 1273 drop=drop, ~/.conda/envs/xclim/lib/python3.8/site-packages/xarray/core/dataset.py in sel(self, indexers, method, tolerance, drop, **indexers_kwargs) 2363 """ 2364 indexers = either_dict_or_kwargs(indexers, indexers_kwargs, "sel") -> 2365 pos_indexers, new_indexes = remap_label_indexers( 2366 self, indexers=indexers, method=method, tolerance=tolerance 2367 ) ~/.conda/envs/xclim/lib/python3.8/site-packages/xarray/core/coordinates.py in remap_label_indexers(obj, indexers, method, tolerance, **indexers_kwargs) 419 } 420 --> 421 pos_indexers, new_indexes = indexing.remap_label_indexers( 422 obj, v_indexers, method=method, tolerance=tolerance 423 ) ~/.conda/envs/xclim/lib/python3.8/site-packages/xarray/core/indexing.py in remap_label_indexers(data_obj, indexers, method, tolerance) 272 coords_dtype = data_obj.coords[dim].dtype 273 label = maybe_cast_to_coords_dtype(label, coords_dtype) --> 274 idxr, new_idx = convert_label_indexer(index, label, dim, method, tolerance) 275 pos_indexers[dim] = idxr 276 if new_idx is not None: ~/.conda/envs/xclim/lib/python3.8/site-packages/xarray/core/indexing.py in convert_label_indexer(index, label, index_name, method, tolerance)
119 "cannot use ~/.conda/envs/xclim/lib/python3.8/site-packages/pandas/core/indexes/base.py in slice_indexer(self, start, end, step, kind) 5684 slice(1, 3, None) 5685 """ -> 5686 start_slice, end_slice = self.slice_locs(start, end, step=step) 5687 5688 # return a slice ~/.conda/envs/xclim/lib/python3.8/site-packages/pandas/core/indexes/base.py in slice_locs(self, start, end, step, kind) 5892 end_slice = None 5893 if end is not None: -> 5894 end_slice = self.get_slice_bound(end, "right") 5895 if end_slice is None: 5896 end_slice = len(self) ~/.conda/envs/xclim/lib/python3.8/site-packages/pandas/core/indexes/base.py in get_slice_bound(self, label, side, kind) 5796 # For datetime indices label may be a string that has to be converted 5797 # to datetime boundary according to its resolution. -> 5798 label = self._maybe_cast_slice_bound(label, side) 5799 5800 # we need to look up the label TypeError: _maybe_cast_slice_bound() missing 1 required positional argument: 'kind' ``` Anything else we need to know?:
A quick diagnostic suggests that Environment: Output of <tt>xr.show_versions()</tt>INSTALLED VERSIONS ------------------ commit: None python: 3.8.6 | packaged by conda-forge | (default, Jan 25 2021, 23:21:18) [GCC 9.3.0] python-bits: 64 OS: Linux OS-release: 5.4.0-77-generic machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: en_CA.UTF-8 LOCALE: ('en_CA', 'UTF-8') libhdf5: 1.10.6 libnetcdf: 4.7.4 xarray: 0.18.2 pandas: 1.3.0 numpy: 1.20.0 scipy: 1.6.3 netCDF4: 1.5.5.1 pydap: None h5netcdf: None h5py: None Nio: None zarr: None cftime: 1.4.1 nc_time_axis: 1.2.0 PseudoNetCDF: None rasterio: None cfgrib: None iris: None bottleneck: 1.3.2 dask: 2021.01.1 distributed: 2021.01.1 matplotlib: 3.4.2 cartopy: None seaborn: None numbagg: None pint: 0.16.1 setuptools: 49.6.0.post20210108 pip: 21.0.1 conda: None pytest: 6.2.2 IPython: 7.20.0 sphinx: 4.0.2 |
{ "url": "https://api.github.com/repos/pydata/xarray/issues/5576/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
completed | 13221727 | issue |