Skip to content

API/BUG: isna_old on EAs? #33209

Closed
Closed
@jbrockmendel

Description

@jbrockmendel

isna_new has a code path that handles EAs that isna_old doesnt, so the following will raise:

pd.set_option("mode.use_inf_as_na", True)
pd.isna(my_decimal_array)

Most of this can be fixed by adding to isna_ndarray_old:

if is_extension_array_dtype(values.dtype):
    result = values.isna()

Then we can add into the interface tests:

    def test_isna_old_extension_array(self, data_missing):
        # TODO: do we need EA.isna to handle `inf`?
        expected = data_missing.isna()
        with cf.option_context("mode.use_inf_as_na", True):
            result = pd.isna(data_missing)

        tm.assert_equal(result, expected)

The two problems here are 1) as in the comment, this may be wrong/ambiguous if the EA has a concept of "inf" and 2) we still get a test failure on StringArray([<NA>, 'A'])

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugExtensionArrayExtending 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