Skip to content

Conversation

@zhan7236
Copy link
Contributor

This PR adds a regression test for #49052.

The bug was that DataFrame.where would return object dtype when other was a Series with nullable dtype (e.g., Int64), while Series.where correctly returned the nullable dtype. This has been fixed on main and this test ensures the fix is not regressed.

def test_where_other_nullable_dtype():
# GH#49052 DataFrame.where should return nullable dtype when
# other is a Series with nullable dtype, matching Series.where behavior
df = Series([1, 2, 3], dtype="int64").to_frame()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
df = Series([1, 2, 3], dtype="int64").to_frame()
df = DataFrame([1, 2, 3], dtype="int64")

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed, thanks.

@mroeschke mroeschke added the Testing pandas testing functions or related to the test suite label Dec 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Testing pandas testing functions or related to the test suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: df.where(ea) coerces to object, rather than nullable dtype like ser.where(ea) does

2 participants