-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: make mean()
raise an exception for strings
#44131
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 are a bunch of issues about reductions with strings. can you see if this closes any of the others? |
Added all the issues I could find that this PR would close, I think we also need to decide whether we want to keep the behavior of |
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.
Your change broke tests. Please add tests for every related issue
Regarding the failing tests (reporting from gitter here): I also can't reproduce those locally when checking out this branch. Not fully sure what would cause this discrepancy (in any case it doesn't seem to be related to the python or numpy version, since CI is failing for several versions of those). |
@phofl I reran the tests after installing the environments from ci using |
ok if you are going to close an issue, pls explicitly make sure its listed in the test its (e.g. a reference) or have an explict test. |
dont' worry about .sum it is fine. |
Not really, no |
@kinshukdua can you add tests specific to each of the issues this is closing |
@jbrockmendel yes, I'll add them, sorry for the delay. |
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.
this warrents a sub-section in the whatsnew e.g. showing what previously worked and the new
The column The column Should I create a different test for each issue? |
can you merge master and will have a look |
@jreback, sorry for the delay, I rebased to fix the merge conflict. |
@kinshukdua this is failing tests |
this is worthile but needs to be passing, and pls merge master |
@jreback as I've explained before, for some reason the tests are all passing on my local environment, I've tried to reproduce the CI as close as possible by using the yaml files to recreate my testing environment. However, the tests still seem to pass. @jorisvandenbossche confirmed it by doing the same . I'm not sure what I should do. |
well sure, we are running multiple environments in CI which may have slightly different behavior. you need to install one of the failing environments and investigate. we cannot merge until CI is green. |
FWIW i wasn't able to reproduce the errors on either my "normal" build or a py38+np1.18.5 build. @kinshukdua is right that something weird is going on here. Doesn't change the fact that the CI needs to get to green before this can be merged. Just saying it's not an easy problem. |
@kinshukdua if you can merge master and get this passing |
Thanks for the effort on this pull request, but it appears to have gone stale. If interested in continuing, please merge in main and we can reopen. |
This PR makes
mean()
raise an exception whensum()
returns a string. Sum performs as expected since it concatenates. However_ensure_numeric
causes implicit conversion ofstr
to a numeric datatypepandas/pandas/core/nanops.py
Line 694 in f3f90c3
Instead of this, the return value of
sum()
will be checked and if it is a string, an exception will be raised.This is a breaking change.