Skip to content

INT: include NA values in Categorical.categories #37930

Open
@jbrockmendel

Description

@jbrockmendel

There are a bunch of places in CategoricalIndex where we check something like:

codes = self.categories.get_indexer(target)
if (codes == -1).any():
    do_something()

This leads to ambiguity, as a -1 code can indicate an NA value that is present, or a non-NA value that is not among self.categories. Having to sort out which we're looking at is a hassle which we should try to avoid.

Metadata

Metadata

Assignees

No one assigned

    Labels

    CategoricalCategorical Data TypeInternalsRelated to non-user accessible pandas implementationPDEP missing valuesIssues that would be addressed by the Ice Cream Agreement from the Aug 2023 sprint

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions