-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
TST: add test to verify column does not lose categorical type when using loc #37988
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
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 @fgebhart for the PR!
Not 100% sure about the location either but pandas/tests/indexing/test_coercion.py
could be the place
failed test is unrelated to my changes - do you collect flaky tests somewhere? i.e. |
5f16e01
to
353bce1
Compare
pandas/tests/indexing/test_loc.py
Outdated
@@ -1285,6 +1286,14 @@ def test_loc_setitem_datetime_keys_cast(self): | |||
expected = DataFrame({"one": [100.0, 200.0]}, index=[dt1, dt2]) | |||
tm.assert_frame_equal(df, expected) | |||
|
|||
def test_loc_setitem_categorical_column_retains_dtype(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 add the ordered fixture (just include it in the arg list and pass to Categorical), it should just work. ping on green.
thanks @fgebhart very nice |
black pandas
git diff upstream/master -u -- "*.py" | flake8 --diff
Added a test to verify the behavior described in issue #16360. However, I'm not 100% sure about the location of the test.