Skip to content

Commit

Permalink
Fix old valid_count usage
Browse files Browse the repository at this point in the history
  • Loading branch information
mroeschke committed Jan 10, 2024
1 parent 042e534 commit 14585f9
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
4 changes: 3 additions & 1 deletion python/cudf/cudf/core/column/categorical.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 not obj.has_nulls()), objs[0])
head = next(
(obj for obj in objs if not obj.null_count != len(obj)), objs[0]
)

# Combine and de-dupe the categories
cats = column.concat_columns([o.categories for o in objs]).unique()
Expand Down
4 changes: 2 additions & 2 deletions python/cudf/cudf/core/column/column.py
Original file line number Diff line number Diff line change
Expand Up @@ -2734,7 +2734,7 @@ def concat_columns(objs: "MutableSequence[ColumnBase]") -> ColumnBase:
# If all columns are `NumericalColumn` with different dtypes,
# we cast them to a common dtype.
# Notice, we can always cast pure null columns
not_null_col_dtypes = [o.dtype for o in objs if not o.has_nulls()]
not_null_col_dtypes = [o.dtype for o in objs if o.null_count != len(o)]
if len(not_null_col_dtypes) and all(
_is_non_decimal_numeric_dtype(dtyp)
and np.issubdtype(dtyp, np.datetime64)
Expand All @@ -2746,7 +2746,7 @@ def concat_columns(objs: "MutableSequence[ColumnBase]") -> ColumnBase:
objs = [obj.astype(common_dtype) for obj in objs]

# Find the first non-null column:
head = next((obj for obj in objs if not obj.has_nulls()), objs[0])
head = next((obj for obj in objs if obj.null_count != len(obj)), objs[0])

for i, obj in enumerate(objs):
# Check that all columns are the same type:
Expand Down
2 changes: 1 addition & 1 deletion python/cudf/cudf/core/dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -8098,7 +8098,7 @@ def _get_non_null_cols_and_dtypes(col_idxs, list_of_columns):
# non-null Column with the same name is found.
if idx not in dtypes:
dtypes[idx] = cols[idx].dtype
if cols[idx].has_nulls():
if cols[idx].null_count != len(cols[idx]):
if idx not in non_null_columns:
non_null_columns[idx] = [cols[idx]]
else:
Expand Down
2 changes: 1 addition & 1 deletion python/cudf/cudf/utils/dtypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ def min_column_type(x, expected_type):

if not isinstance(x, cudf.core.column.NumericalColumn):
raise TypeError("Argument x must be of type column.NumericalColumn")
if not x.has_nulls():
if x.null_count == len(x):
return x.dtype

if np.issubdtype(x.dtype, np.floating):
Expand Down

0 comments on commit 14585f9

Please sign in to comment.