Skip to content

Add arithmetic to categoricals? #8629

Closed
@shoyer

Description

@shoyer

I'm not entirely sure why (perhaps just the trouble of implementing it), but categoricals do not currently support arithmetic:

In contrast to statistical categorical variables, categorical data might have an order (e.g. ‘strongly agree’ vs ‘agree’ or ‘first observation’ vs. ‘second observation’), but numerical operations (additions, divisions, ...) are not possible.

Similarly to string operations (#8627), arithmetic with scalars could very efficient transform categoricals into new categoricals.

In contrast, array + array operations should probably just return a normal array.

CC @JanSchultz @jreback

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