-
-
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
DEPR: Deprecate the convert_dtype param in Series.Apply #52257
DEPR: Deprecate the convert_dtype param in Series.Apply #52257
Conversation
pandas/core/series.py
Outdated
else: | ||
warnings.warn( | ||
"the convert_dtype parameter is deprecated and will be removed in a " | ||
"future version.", |
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.
Would be good to mention the alternative here if convert_dtype=False was specified
Co-authored-by: Matthew Roeschke <[email protected]>
I’ve updated. |
Thanks @topper-123 |
…2257) * DEPR: Deprecate param convert_dtype in Series.Apply * fix StataReader * fix issue * Update pandas/core/series.py Co-authored-by: Matthew Roeschke <[email protected]> * explain more in warning --------- Co-authored-by: Matthew Roeschke <[email protected]>
…2257) * DEPR: Deprecate param convert_dtype in Series.Apply * fix StataReader * fix issue * Update pandas/core/series.py Co-authored-by: Matthew Roeschke <[email protected]> * explain more in warning --------- Co-authored-by: Matthew Roeschke <[email protected]>
@topper-123 what's the rationale of this deprecation? I suppose just to get rid of a probably-not-used-much keyword, and it's something that doesn't exist anyway in But, if that's the case, I think the message about the alternative is wrong? Unless you plan to actually make the future behaviour to be Currently the text says:
But also right now, we do infer the dtype of the result, even if the starting dtype was object. So with our current behaviour, first casting to object dtype before calling |
Thinking about it now again, removing My original idea was actually to move
Hm, yeah, I see this point, I didn't consider object dtype, when I wrote the error message, I must admit, so the question is how to deal with it. I think there are two options: 1: Implement I'm not super sure what direction is best. Generally, operating element-wise makes it very difficult to guarantee a certain return dtype because an array has to be constructed and we can't know what dtype is should have. E.g. for something like I guess the choice depends on how much people value the option to do |
I didn't not realize the work around didn't work. I'm in favor of reverting this deprecation and added |
Depreates the
convert_dtype
parameter inSeries.apply
. Also does some minor clean-ups inlib.pyx
.Progress towards #52140.