-
-
Notifications
You must be signed in to change notification settings - Fork 18k
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
Groupby aggregations could ignore non-numeric columns when axis=1 #3688
Comments
this is the question, but still breaks (even on my new branch).... will look at this soon |
linking to #3679 |
Any update on this @jreback? Did your branch ever go anywhere? |
you are welcome to do a pr if u would like |
Still a problem, though note that this only fails due to |
Nowadays running the example results in a FutureWarning at both operations. In [3]: df.mean()
FutureWarning: Dropping of nuisance columns in DataFrame reductions (with 'numeric_only=None') is deprecated; in a future version this will raise TypeError. Select only valid columns before calling the reduction.
In [4]: df.groupby(level=0, axis=1).mean()
FutureWarning: Dropping invalid columns in DataFrameGroupBy.mean is deprecated. In a future version, a TypeError will be raised. Before calling .mean, select only columns which should be valid for the function.
df.groupby(level=0, axis=1).mean()
Out[4]:
Empty DataFrame
Columns: [bar, foo, hello]
Index: [] This change was introduced by PR #41480. So, nowadays groupby aggregations should NOT ignore non-numeric columns. Closing this issue. |
Perhaps the following groupby aggregation should work only the numeric columns, as they would when using the dataframe:
From this SO question, where I gave very hacky workaround.
cc #3683 @jreback was this the question you were talking about? This ones related but in the sense of coming up against non unique problems... Thought I should mention it here anyway.
The text was updated successfully, but these errors were encountered: