-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
TST: category isin on frame #34363
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
TST: category isin on frame #34363
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 @vampypandya
expected1 = DataFrame({"a": [True, True, True], "b": [False, False, False]}) | ||
expected2 = DataFrame({"a": [True, True, True], "b": [False, False, False]}) |
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.
What's the difference between these two? Can you just use one, call it expected
, and use it for both assertions?
"category", | ||
[ | ||
pd.DataFrame({"a": [1, 2, 3]}, dtype="category"), | ||
pd.Series([1, 2, 3]).astype("category"), |
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.
You can set this using dtype="category" instead of astyping
@@ -189,3 +189,18 @@ def test_isin_empty_datetimelike(self): | |||
tm.assert_frame_equal(result, expected) | |||
result = df1_td.isin(df3) | |||
tm.assert_frame_equal(result, expected) | |||
|
|||
@pytest.mark.parametrize( | |||
"category", |
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.
Rather than calling this argument "category" something like "values" or "other" (for example) seems more appropriate
) | ||
def test_isin_category_frame(self, category): | ||
# GH#34256 | ||
df = pd.DataFrame.from_dict({"a": [1, 2, 3], "b": [4, 5, 6]}) |
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.
I don't think we need from_dict here
@vampypandya can you update with the requested changes? |
thanks @vampypandya |
black pandas
git diff upstream/master -u -- "*.py" | flake8 --diff