Skip to content

TST: Test Series' settitem with Interval and NaN #43844

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 4 commits into from
Oct 5, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions pandas/tests/indexing/test_iloc.py
Original file line number Diff line number Diff line change
Expand Up @@ -931,6 +931,17 @@ def test_iloc_setitem_td64_values_cast_na(self, value):
expected = Series([NaT, 1, 2], dtype="timedelta64[ns]")
tm.assert_series_equal(series, expected)

@pytest.mark.parametrize("not_na", [Interval(0, 1), "a", 1.0])
def test_setitem_mix_of_nan_and_interval(self, not_na, nulls_fixture):
# GH#27937
dtype = CategoricalDtype(categories=[not_na])
ser = Series(
[nulls_fixture, nulls_fixture, nulls_fixture, nulls_fixture], dtype=dtype
)
ser.iloc[:3] = [nulls_fixture, not_na, nulls_fixture]
exp = Series([nulls_fixture, not_na, nulls_fixture, nulls_fixture], dtype=dtype)
tm.assert_series_equal(ser, exp)

def test_iloc_setitem_empty_frame_raises_with_3d_ndarray(self):
idx = Index([])
obj = DataFrame(np.random.randn(len(idx), len(idx)), index=idx, columns=idx)
Expand Down