-
-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
BUG: Series / DataFrame reductions convert string data to numeric #34671
Comments
I think we clearly don't want to do this, for the above case. |
Agreed. At the very least, we'll want to ensure we have a test that something like |
isn’t this the same treatment for min/max median is an ordering lookup not dependent on the type (except for ties) |
min / max doesn't first convert to float In [14]: pd.Series(['1', '2']).min()
Out[14]: '1'
(how does it get 6.0 there though? 😄) |
Ah boy .. But so it's not only median. BTW, just checked, the reason for 6 is actually because "1" + "2" is "12", and then we convert to numeric 12, and divide by the count ... :) |
i believe we handle object dtype like this to make this work if we happen to have numeric in object type we should infer in object dtype for a more specific numeric type before performing these ops |
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
(optional) I have confirmed this bug exists on the master branch of pandas.
Code Sample, a copy-pastable example
Problem description
median
should not convert the input types. We seem to explicitly convert all non-float dtypes innanmedian
. Do we want to do that?Expected Output
TypeError or ValueError. Not sure
The text was updated successfully, but these errors were encountered: