Skip to content

Clean: Categorical.fillna NaN in categories checking #19787

Closed
@TomAugspurger

Description

@TomAugspurger

We don't allow NaN in the categories anymore, so this block should be unreachable.

# Make sure that we also get NA in categories
if self.categories.dtype.kind in ['S', 'O', 'f']:
if np.nan in self.categories:
values = values.copy()
nan_pos = np.where(isna(self.categories))[0]
# we only have one NA in categories
values[values == nan_pos] = -1

If anyone wants to remove it and test things out.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions