Skip to content

Commit

Permalink
make kind an optional param.
Browse files Browse the repository at this point in the history
  • Loading branch information
galipremsagar committed Sep 7, 2021
1 parent 1f7c111 commit 1ded3a3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion python/cudf/cudf/core/_base_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 7 additions & 2 deletions python/cudf/cudf/core/column/column.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,)
Expand Down
2 changes: 1 addition & 1 deletion python/cudf/cudf/core/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand Down

0 comments on commit 1ded3a3

Please sign in to comment.