Skip to content

ExtensionArray.__fillna__ should not use lib.is_scalar #20411

Closed
@TomAugspurger

Description

@TomAugspurger

lib.is_scalar is a bit too strict for the check we do in

if not is_scalar(value):
. For example, it doesn't condisder ipaddress.IPv4Address as a scalar.

In [1]: from pandas._libs import lib

In [2]: import ipaddress

In [3]: lib.is_scalar(ipaddress.IPv4Address(1))
Out[3]: False

Replacing that check with a hasattr(value, '__len__') should be sufficient.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ExtensionArrayExtending pandas with custom dtypes or arrays.Missing-datanp.nan, pd.NaT, pd.NA, dropna, isnull, interpolate

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions