Skip to content

BUG: DataFrameGroupBy.quantile raises for non-numeric dtypes rather than dropping columns #34756

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 3 commits into from
Jul 16, 2020

Conversation

rhshadrach
Copy link
Member

@rhshadrach rhshadrach commented Jun 13, 2020

Unlike what is mentioned in #27892, this will raise if there are no columns to aggregate. Both mean and median raise with "No numeric types to aggregate" in such a case, so I was thinking perhaps we should be consistent with them. Any thoughts @WillAyd and @TomAugspurger?

@jreback
Copy link
Contributor

jreback commented Jun 15, 2020

looks like you are including the changes in #34372 here as well

@gfyoung gfyoung added Bug Groupby Regression Functionality that used to work in a prior pandas version labels Jun 18, 2020
@rhshadrach rhshadrach marked this pull request as ready for review June 19, 2020 00:23
@rhshadrach rhshadrach changed the title DataFrameGroupBy.quantile raises for non-numeric dtypes rather than dropping columns BUG: DataFrameGroupBy.quantile raises for non-numeric dtypes rather than dropping columns Jun 19, 2020
@rhshadrach rhshadrach force-pushed the quantile_regression branch 2 times, most recently from 794788d to 9f379ac Compare June 24, 2020 20:07
@@ -232,3 +232,11 @@ def test_groupby_quantile_nullable_array(values, q):

expected = pd.Series(true_quantiles * 2, index=idx, name="b")
tm.assert_series_equal(result, expected)


@pytest.mark.parametrize("q", [0.5, [0.0, 0.5, 1.0]])
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 also try with an empty frame that has the same dtypes, that should raise?

Copy link
Member Author

@rhshadrach rhshadrach Jun 25, 2020

Choose a reason for hiding this comment

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

It does not raise on an empty frame, but instead returns an empty frame with the columns that are valid dtypes, in the case of the test Columns: [b].

@TomAugspurger
Copy link
Contributor

@rhshadrach merging master should fix the CI failure.

@rhshadrach rhshadrach force-pushed the quantile_regression branch from 3b39fc0 to 441d251 Compare July 6, 2020 20:11
@rhshadrach
Copy link
Member Author

@jreback - the response never updated but Travis passed. Responses to your questions are above.

@rhshadrach rhshadrach closed this Jul 11, 2020
@rhshadrach rhshadrach deleted the quantile_regression branch July 11, 2020 16:00
@rhshadrach rhshadrach restored the quantile_regression branch July 11, 2020 16:00
@rhshadrach
Copy link
Member Author

Accidentally deleted PR branch

@rhshadrach rhshadrach reopened this Jul 11, 2020
@rhshadrach
Copy link
Member Author

@jreback Friendly ping. Responses to your questions are above.

@jreback jreback added this to the 1.1 milestone Jul 16, 2020
@jreback jreback merged commit 697a538 into pandas-dev:master Jul 16, 2020
@jreback
Copy link
Contributor

jreback commented Jul 16, 2020

thanks @rhshadrach

@rhshadrach rhshadrach deleted the quantile_regression branch October 11, 2020 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Groupby Regression Functionality that used to work in a prior pandas version
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DataFrameGroupBy.quantile raises for non-numeric dtypes rather than dropping columns
4 participants