-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
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
Conversation
pandas/tests/indexing/test_iloc.py
Outdated
@@ -931,6 +931,14 @@ def test_iloc_setitem_td64_values_cast_na(self, value): | |||
expected = Series([NaT, 1, 2], dtype="timedelta64[ns]") | |||
tm.assert_series_equal(series, expected) | |||
|
|||
def test_setitem_mix_of_nan_and_interval(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you parameterize on all the cases in the OP
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I parametrized the NA and the non-NA value, let me know if I should add more cases.
Fixes pandas-dev#27937. As described in that issue, assigning a mixture of NaN and Interval values into a slice of a categorical-typed series would raise an exception. This is no longer the case.
97ee2aa
to
e0a29ca
Compare
pandas/tests/indexing/test_iloc.py
Outdated
@@ -931,6 +931,16 @@ 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]) | |||
@pytest.mark.parametrize("na", [np.nan, NaT]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you use nulls_fixture
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very cool, yes. Fixed.
thanks @ElDeveloper very nice! |
Thanks so much for your feedback! |
Fixes #27937. As described in that issue, assigning a mixture of NaN and
Interval values into a slice of a categorical-typed series would raise
an exception. This is no longer the case.