-
Notifications
You must be signed in to change notification settings - Fork 915
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove unneeded methods in Column #14730
Changes from all commits
2fe3d48
00b4c6e
b56542a
042e534
14585f9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -1381,7 +1381,9 @@ def _concat( | |||||
# improved as the concatenation API is solidified. | ||||||
|
||||||
# Find the first non-null column: | ||||||
head = next((obj for obj in objs if obj.valid_count), objs[0]) | ||||||
head = next( | ||||||
(obj for obj in objs if not obj.null_count != len(obj)), objs[0] | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. issue I think this logic is wrong. The old code was equivalent to:
Rearranging the condition:
So we've gained an extra negation.
Suggested change
|
||||||
) | ||||||
|
||||||
# Combine and de-dupe the categories | ||||||
cats = column.concat_columns([o.categories for o in objs]).unique() | ||||||
|
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -140,7 +140,7 @@ def indices_of(self, value: ScalarLike) -> NumericalColumn: | |||||||||||||
else: | ||||||||||||||
return super().indices_of(value) | ||||||||||||||
|
||||||||||||||
def has_nulls(self, include_nan=False): | ||||||||||||||
def has_nulls(self, include_nan: bool = False) -> bool: | ||||||||||||||
return bool(self.null_count != 0) or ( | ||||||||||||||
include_nan and bool(self.nan_count != 0) | ||||||||||||||
) | ||||||||||||||
Comment on lines
+143
to
146
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||
|
@@ -425,10 +425,6 @@ def dropna(self, drop_nan: bool = False) -> NumericalColumn: | |||||||||||||
col = self.nans_to_nulls() if drop_nan else self | ||||||||||||||
return drop_nulls([col])[0] | ||||||||||||||
|
||||||||||||||
@property | ||||||||||||||
def contains_na_entries(self) -> bool: | ||||||||||||||
return (self.nan_count != 0) or (self.null_count != 0) | ||||||||||||||
|
||||||||||||||
def _process_values_for_isin( | ||||||||||||||
self, values: Sequence | ||||||||||||||
) -> Tuple[ColumnBase, ColumnBase]: | ||||||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1710,7 +1710,7 @@ def _concat(cls, objs, axis=0, index=True): | |
@_cudf_nvtx_annotate | ||
def valid_count(self): | ||
"""Number of non-null values""" | ||
return self._column.valid_count | ||
return len(self) - self._column.null_count | ||
Comment on lines
1710
to
+1713
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not here for API compat (pandas series do not have a |
||
|
||
@property # type: ignore | ||
@_cudf_nvtx_annotate | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit
Optional[Literal["ix", "loc", "getitem"]]
?