Skip to content

tm.assert_index_equal broken with pd.NA and np.NaT sentinel #31884

Closed
@WillAyd

Description

@WillAyd

Discovered in #31799

I couldn't reproduce this without using a np.* NaT sentinel...

>>> idx1 = pd.Index([pd.NA, np.datetime64("nat")])
>>> idx2 = pd.Index([pd.NA, pd.NaT])
>>> tm.assert_index_equal(idx1, idx2)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/williamayd/clones/pandas/pandas/_testing.py", line 689, in assert_index_equal
    diff = np.sum((left.values != right.values).astype(int)) * 100.0 / len(left)
AttributeError: 'bool' object has no attribute 'astype'

Metadata

Metadata

Assignees

No one assigned

    Labels

    Missing-datanp.nan, pd.NaT, pd.NA, dropna, isnull, interpolateNA - MaskedArraysRelated to pd.NA and nullable extension arraysNeeds TestsUnit test(s) needed to prevent regressionsTestingpandas testing functions or related to the test suitegood first issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions