We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1b5b02c commit d82de16Copy full SHA for d82de16
pandas/tests/frame/indexing/test_where.py
@@ -1063,3 +1063,13 @@ def test_where_inplace_no_other():
1063
assert result is df
1064
expected = DataFrame({"a": [1, np.nan], "b": [np.nan, "y"]})
1065
tm.assert_frame_equal(df, expected)
1066
+
1067
1068
+def test_where_other_nullable_dtype():
1069
+ # GH#49052 DataFrame.where should return nullable dtype when
1070
+ # other is a Series with nullable dtype, matching Series.where behavior
1071
+ df = Series([1, 2, 3], dtype="int64").to_frame()
1072
+ other = Series([pd.NA, pd.NA, pd.NA], dtype="Int64")
1073
+ result = df.where(df > 1, other, axis=0)
1074
+ expected = DataFrame({0: Series([pd.NA, 2, 3], dtype="Int64")})
1075
+ tm.assert_frame_equal(result, expected)
0 commit comments