Skip to content

TST: DataFrame.equals array-vs-scalar object element (GH#43867)#66032

Merged
jbrockmendel merged 1 commit into
pandas-dev:mainfrom
jbrockmendel:bug-43867
Jun 26, 2026
Merged

TST: DataFrame.equals array-vs-scalar object element (GH#43867)#66032
jbrockmendel merged 1 commit into
pandas-dev:mainfrom
jbrockmendel:bug-43867

Conversation

@jbrockmendel

Copy link
Copy Markdown
Member

closes #43867

DataFrame.equals used to return True when an object-dtype element was a numpy array in one frame and a scalar in the other (e.g. np.array(["a"]) vs "a"). This was fixed by the PyArray_Check guard added to array_equivalent_object in GH-59778; this adds a regression test for the exact repro.

The test pins both columns to object dtype so it exercises the array-vs-scalar element comparison rather than a str-vs-object dtype mismatch.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jbrockmendel jbrockmendel added Testing pandas testing functions or related to the test suite Nested Data Data where the values are collections (lists, sets, dicts, objects, etc.). labels Jun 26, 2026
@jbrockmendel jbrockmendel marked this pull request as ready for review June 26, 2026 16:25
@jbrockmendel jbrockmendel merged commit dd2301c into pandas-dev:main Jun 26, 2026
49 of 52 checks passed
@jbrockmendel jbrockmendel deleted the bug-43867 branch June 26, 2026 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Nested Data Data where the values are collections (lists, sets, dicts, objects, etc.). Testing pandas testing functions or related to the test suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: DataFrame.equals returns True when compared elements differ in being np.arrays

1 participant