diff --git a/python/cudf/cudf/core/_base_index.py b/python/cudf/cudf/core/_base_index.py index 8637f96f34a..163af62677e 100644 --- a/python/cudf/cudf/core/_base_index.py +++ b/python/cudf/cudf/core/_base_index.py @@ -821,7 +821,7 @@ def to_series(self, index=None, name=None): name=self.name if name is None else name, ) - def get_slice_bound(self, label, side, kind): + def get_slice_bound(self, label, side, kind=None): """ Calculate slice bound that corresponds to given label. Returns leftmost (one-past-the-rightmost if ``side=='right'``) position diff --git a/python/cudf/cudf/core/column/column.py b/python/cudf/cudf/core/column/column.py index 2e9a0c6c79d..8f18d83eb31 100644 --- a/python/cudf/cudf/core/column/column.py +++ b/python/cudf/cudf/core/column/column.py @@ -852,8 +852,13 @@ def get_slice_bound( side : {'left', 'right'} kind : {'ix', 'loc', 'getitem'} """ - assert kind in ["ix", "loc", "getitem", None] - if side not in ("left", "right"): + if kind not in {"ix", "loc", "getitem", None}: + raise ValueError( + f"Invalid value for ``kind`` parameter," + f" must be either one of the following: " + f"{'ix', 'loc', 'getitem', None}, but found: {kind}" + ) + if side not in {"left", "right"}: raise ValueError( "Invalid value for side kwarg," " must be either 'left' or 'right': %s" % (side,) diff --git a/python/cudf/cudf/core/index.py b/python/cudf/cudf/core/index.py index 6b4b77fabc5..b009d12262f 100644 --- a/python/cudf/cudf/core/index.py +++ b/python/cudf/cudf/core/index.py @@ -990,7 +990,7 @@ def find_label_range(self, first, last): end += 1 return begin, end - def get_slice_bound(self, label, side, kind): + def get_slice_bound(self, label, side, kind=None): return self._values.get_slice_bound(label, side, kind)