-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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
0.17 regression: convert_objects coercion with multiple dtypes #11116
Comments
@AmbroseKeith thanks for the report. I changed to title to be more helpful than "utterly broken" @jreback I think there's two bugs here. First the multiple dtypes, where the bools are getting mixed in with the Datetime block and getting coerced to NaN. At least that's my guess. The last example, |
This looks correct to me. You asked it to take an
In general expecting force converting to work always is simply user-error. It is impossible to guess things reliably (and this is why this was changed). If you have dates, use Applying this on a |
Though I agree with @TomAugspurger
|
…e a ValueError on old-style input - raise a ValueError for df.convert_objects('coerce') - raise a ValueError for df.convert_objects(convert_dates='coerce') (and convert_numeric,convert_timedelta)
In any case, the whatsnew entry will have to be much more explicit about these changes, as this has a big impact on the result if you use I think we should think about if it is possible to implement the new behaviour without breaking the existing usage. |
Trying to handle the legacy usage was a bad fit given the substantial change int he behavior of convert objects - it isn't just a keyword renaming, but a removal of the magic of the old version. The examples in the original post are all correct as intended, although I agree that |
Restores the v0.16 behavior of convert_objects and moves the new version of _convert Adds to_numeric for directly converting numeric data closes pandas-dev#11116 closes pandas-dev#11133
I upgraded from 0.16.2 to 0.17/master and it broke working code.
0.16.2:
0.17/master:
booleans get cast to datetimes now?! Usually deprecation means "avoid in new code" and not that your working code will break, otherwise it wouldn't be a deprecation but a breaking change. So that's not good, but ok, let's follow the helpful hint:
wut?, booleans become floats and almost-datetimes aren't converted at all anymore?
The text was updated successfully, but these errors were encountered: