DEPR: kind kwarg in _maybe_cast_slice_bound by jbrockmendel · Pull Request #41378 · pandas-dev/pandas (original) (raw)
$ docker run -it --rm --entrypoint bash pavics/workflow-tests:preview
$ conda init bash
$ bash
$ conda activate birdy
$ conda env export |grep pandas
- geopandas=0.9.0=pyhd8ed1ab_1
- geopandas-base=0.9.0=pyhd8ed1ab_1
- intake-geopandas=0.2.4=pyhd8ed1ab_0
- pandas=1.3.0=py37h219a48f_0
18🔞02 _________ finch-master/docs/source/notebooks/dap_subset.ipynb::Cell 2 __________
18🔞02 Notebook cell execution failed
18🔞02 Cell 2: Cell execution caused an exception
18🔞02
18🔞02 Input:
18🔞02 #NBVAL_IGNORE_OUTPUT
18🔞02 # Use the `remap_label_indexers` function to convert coordinates to *positional* indexes.
18🔞02 import datetime as dt
18🔞02 coords = dict(lat=45, lon=290)
18🔞02 index, _ = xr.core.coordinates.remap_label_indexers(ds, coords, method="nearest")
18🔞02
18🔞02 # The `nearest` method cannot be used with slices, so we do another call for the time period.
18🔞02 ti, _ = xr.core.coordinates.remap_label_indexers(ds, dict(time=slice("2060-01-01", "2064-12-30")))
18🔞02
18🔞02 # Merge the spatial and temporal indices
18🔞02 index.update(ti)
18🔞02 index
18🔞02
18🔞02 Traceback:
18🔞02
18🔞02 ---------------------------------------------------------------------------
18🔞02 TypeError Traceback (most recent call last)
18🔞02 <ipython-input-3-d0a5be34f657> in <module>
18🔞02 6
18🔞02 7 # The `nearest` method cannot be used with slices, so we do another call for the time period.
18🔞02 ----> 8 ti, _ = xr.core.coordinates.remap_label_indexers(ds, dict(time=slice("2060-01-01", "2064-12-30")))
18🔞02 9
18🔞02 10 # Merge the spatial and temporal indices
18🔞02
18🔞02 /opt/conda/envs/birdy/lib/python3.7/site-packages/xarray/core/coordinates.py in remap_label_indexers(obj, indexers, method, tolerance, **indexers_kwargs)
18🔞02 420
18🔞02 421 pos_indexers, new_indexes = indexing.remap_label_indexers(
18🔞02 --> 422 obj, v_indexers, method=method, tolerance=tolerance
18🔞02 423 )
18🔞02 424 # attach indexer's coordinate to pos_indexers
18🔞02
18🔞02 /opt/conda/envs/birdy/lib/python3.7/site-packages/xarray/core/indexing.py in remap_label_indexers(data_obj, indexers, method, tolerance)
18🔞02 272 coords_dtype = data_obj.coords[dim].dtype
18🔞02 273 label = maybe_cast_to_coords_dtype(label, coords_dtype)
18🔞02 --> 274 idxr, new_idx = convert_label_indexer(index, label, dim, method, tolerance)
18🔞02 275 pos_indexers[dim] = idxr
18🔞02 276 if new_idx is not None:
18🔞02
18🔞02 /opt/conda/envs/birdy/lib/python3.7/site-packages/xarray/core/indexing.py in convert_label_indexer(index, label, index_name, method, tolerance)
18🔞02 122 _sanitize_slice_element(label.start),
18🔞02 123 _sanitize_slice_element(label.stop),
18🔞02 --> 124 _sanitize_slice_element(label.step),
18🔞02 125 )
18🔞02 126 if not isinstance(indexer, slice):
18🔞02
18🔞02 /opt/conda/envs/birdy/lib/python3.7/site-packages/pandas/core/indexes/base.py in slice_indexer(self, start, end, step, kind)
18🔞02 5684 slice(1, 3, None)
18🔞02 5685 """
18🔞02 -> 5686 start_slice, end_slice = self.slice_locs(start, end, step=step)
18🔞02 5687
18🔞02 5688 # return a slice
18🔞02
18🔞02 /opt/conda/envs/birdy/lib/python3.7/site-packages/pandas/core/indexes/base.py in slice_locs(self, start, end, step, kind)
18🔞02 5886 start_slice = None
18🔞02 5887 if start is not None:
18🔞02 -> 5888 start_slice = self.get_slice_bound(start, "left")
18🔞02 5889 if start_slice is None:
18🔞02 5890 start_slice = 0
18🔞02
18🔞02 /opt/conda/envs/birdy/lib/python3.7/site-packages/pandas/core/indexes/base.py in get_slice_bound(self, label, side, kind)
18🔞02 5796 # For datetime indices label may be a string that has to be converted
18🔞02 5797 # to datetime boundary according to its resolution.
18🔞02 -> 5798 label = self._maybe_cast_slice_bound(label, side)
18🔞02 5799
18🔞02 5800 # we need to look up the label
18🔞02
18🔞02 TypeError: _maybe_cast_slice_bound() missing 1 required positional argument: 'kind'