Skip to content

TST: Test type issue fix in empty groupby from DataFrame with categorical #29355

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
Nov 13, 2019

Conversation

louishuynh
Copy link
Contributor

@louishuynh louishuynh commented Nov 2, 2019

TST: Test type issue fix in empty groupby from DataFrame with categorical

closes #9614

@simonjayhawkins simonjayhawkins added the Testing pandas testing functions or related to the test suite label Nov 2, 2019
@louishuynh louishuynh changed the title TST: Test type issue fix in empty groupby from DataFrame with cataegorical TST: Test type issue fix in empty groupby from DataFrame with categorical Nov 2, 2019
@jreback jreback added Categorical Categorical Data Type Groupby labels Nov 2, 2019
@jreback jreback added this to the 1.0 milestone Nov 2, 2019
@@ -1825,6 +1825,18 @@ def test_groupby_empty_list_raises():
df.groupby([[]])


def test_groupby_with_empty_category():
Copy link
Contributor

Choose a reason for hiding this comment

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

can you move this to groupby/test_categorical.py

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, thanks!

# GH-9614
df = pd.DataFrame({"id": [None] * 3, "spam": [None] * 3})
df["spam"] = df["spam"].astype("category")
df["spam"] == "spam" # works as expected
Copy link
Contributor

Choose a reason for hiding this comment

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

can you assert this result here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've refactored to what I think is more clear & explicit.
Please approve fine or let me know more asserts still needed, thanks!

@pep8speaks
Copy link

pep8speaks commented Nov 2, 2019

Hello @louishuynh! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2019-11-12 19:05:15 UTC

@jbrockmendel jbrockmendel force-pushed the test-groupby-on-categorical branch from 480f76c to 4b77aaa Compare November 12, 2019 19:05
@jreback jreback merged commit 719ab02 into pandas-dev:master Nov 13, 2019
@jreback
Copy link
Contributor

jreback commented Nov 13, 2019

thanks @louishuynh

Reksbril pushed a commit to Reksbril/pandas that referenced this pull request Nov 18, 2019
proost pushed a commit to proost/pandas that referenced this pull request Dec 19, 2019
proost pushed a commit to proost/pandas that referenced this pull request Dec 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Categorical Categorical Data Type Groupby Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Type issue in empty groupby from DataFrame with categorical
4 participants