Skip to content

BUG: setitem with boolean mask and series as value is broken for Series with EA type #37676

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Nov 17, 2020
9 changes: 9 additions & 0 deletions pandas/tests/series/indexing/test_setitem.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,15 @@ def test_setitem_boolean_different_order(self, string_series):

tm.assert_series_equal(copy, expected)

@pytest.mark.parametrize("value", [None, NaT, np.nan])
Copy link
Member

Choose a reason for hiding this comment

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

can you also check that np.datetime64("NaT") doesn't get cast to td64

Copy link
Member

Choose a reason for hiding this comment

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

why did this disappear?

Copy link
Member Author

Choose a reason for hiding this comment

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

Thats not from my change, that got introduced by 5c4f737

def test_setitem_boolean_td64_values_cast_na(self, value):
# GH#18586
series = Series([0, 1, 2], dtype="timedelta64[ns]")
mask = series == series[0]
series[mask] = value
expected = Series([NaT, 1, 2], dtype="timedelta64[ns]")
tm.assert_series_equal(series, expected)

def test_setitem_boolean_nullable_int_types(self, any_nullable_int_dtype):
# GH: 26468
ser = Series(pd_array([5, 6, 7, 8], dtype=any_nullable_int_dtype))
Copy link
Member

Choose a reason for hiding this comment

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

No need for the pd.array here, since the Series constructor will handle the nullable dtype as well.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thx, removed it

Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.