Skip to content

Commit

Permalink
Fix copyrights.
Browse files Browse the repository at this point in the history
  • Loading branch information
vyasr committed Feb 18, 2022
1 parent cc0c614 commit f073c00
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 16 deletions.
9 changes: 5 additions & 4 deletions python/cudf/cudf/core/_base_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -1347,13 +1347,14 @@ def isin(self, values):
array([ True, False, False])
"""

# Even though only list-like objects are supposed to be passed, only
# scalars throw errors. Other types (like dicts) just transparently
# return False (see the implementation of ColumnBase.isin).
# To match pandas behavior, even though only list-like objects are
# supposed to be passed, only scalars throw errors. Other types (like
# dicts) just transparently return False (see the implementation of
# ColumnBase.isin).
if is_scalar(values):
raise TypeError(
"only list-like objects are allowed to be passed "
f"to isin(), you passed a [{type(values).__name__}]"
f"to isin(), you passed a {type(values).__name__}"
)

return self._values.isin(values).values
Expand Down
18 changes: 8 additions & 10 deletions python/cudf/cudf/core/dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -5173,15 +5173,15 @@ def isin(self, values):
# TODO: propagate nulls through isin
# https://github.com/rapidsai/cudf/issues/7556

fill_value = cudf.Scalar(False)

def make_false_column_like_self():
return column.full(size=len(self), fill_value=False, dtype="bool")
return column.full(len(self), fill_value, "bool")

# Preprocess different input types into a mapping from column names to
# a list of values to check.
result = {}
if isinstance(values, (Series, DataFrame)):
obj_dtype = cudf.dtype("object")

if isinstance(values, IndexedFrame):
# Note: In the case where values is a Series, computing some
# information about the values column outside the loop may result
# in performance gains. However, since categorical conversion
Expand Down Expand Up @@ -5213,16 +5213,14 @@ def make_false_column_like_self():
# because if only one was categorical then it's already
# been converted and we have to check if they're strings.
if self_is_cat and other_is_cat:
self_is_obj = other_is_obj = False
self_is_str = other_is_str = False
else:
# These checks must happen after the conversions above
# since numpy can't handle categorical dtypes.
self_is_obj = np.issubdtype(self_col.dtype, obj_dtype)
other_is_obj = np.issubdtype(
other_col.dtype, obj_dtype
)
self_is_str = is_string_dtype(self_col.dtype)
other_is_str = is_string_dtype(other_col.dtype)

if self_is_obj != other_is_obj:
if self_is_str != other_is_str:
# Strings can't compare to anything else.
result[col] = make_false_column_like_self()
else:
Expand Down
2 changes: 1 addition & 1 deletion python/cudf/cudf/tests/test_index.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2018-2021, NVIDIA CORPORATION.
# Copyright (c) 2018-2022, NVIDIA CORPORATION.

"""
Test related to Index
Expand Down
2 changes: 1 addition & 1 deletion python/cudf/cudf/tests/test_series.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2020-2021, NVIDIA CORPORATION.
# Copyright (c) 2020-2022, NVIDIA CORPORATION.

import operator
import re
Expand Down

0 comments on commit f073c00

Please sign in to comment.