Skip to content

COMPAT: TestUnique.test_first_nan_kept failed for Python 3.10.0b1 #41367

Closed
@fangchenli

Description

@fangchenli
________________________ TestUnique.test_first_nan_kept ________________________

self = <pandas.tests.test_algos.TestUnique object at 0x7efe1274c760>

    def test_first_nan_kept(self):
        # GH 22295
        # create different nans from bit-patterns:
        bits_for_nan1 = 0xFFF8000000000001
        bits_for_nan2 = 0x7FF8000000000001
        NAN1 = struct.unpack("d", struct.pack("=Q", bits_for_nan1))[0]
        NAN2 = struct.unpack("d", struct.pack("=Q", bits_for_nan2))[0]
        assert NAN1 != NAN1
        assert NAN2 != NAN2
        for el_type in [np.float64, object]:
            a = np.array([NAN1, NAN2], dtype=el_type)
            result = pd.unique(a)
>           assert result.size == 1
E           assert 2 == 1
E            +  where 2 = array([nan, nan], dtype=object).size

pandas/tests/test_algos.py:798: AssertionError

Note: I cannot reproduce it on M1 mac.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugCompatpandas objects compatability with Numpy or Python functionsPython 3.10

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions