Skip to content

Issue warning in slow ExtensionArray base methods #24433

Open
@TomAugspurger

Description

@TomAugspurger

In the ExtensionArray docstring, we note that

    Some methods require casting the ExtensionArray to an ndarray of Python
    objects with ``self.astype(object)``, which may be expensive. When
    performance is a concern, we highly recommend overriding the following
    methods:

    * fillna
    * dropna
    * unique
    * factorize / _values_for_factorize
    * argsort / _values_for_argsort

I think we should also issue a warning in those cases. We would filter the warning by default, so it doesn't appear to users, but would show up when the base tests are being run. Then the EA author can choose to ignore that warning, or implement it more efficiently.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ExtensionArrayExtending pandas with custom dtypes or arrays.PerformanceMemory or execution speed performanceWarningsWarnings that appear or should be added to pandas

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions