-
-
Notifications
You must be signed in to change notification settings - Fork 18.2k
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
PDEP-6: Ban upcasting in setitem-like operations #50424
Conversation
I like it! 2 questions
|
Thanks @asishm for taking a look! Setting an out-of-bounds value in an |
Thanks for your reviews! Right, I think it's time for yet another @pandas-dev/pandas-core @pandas-dev/pandas-triage ping...would love to hear people's thoughts on this |
I think you should be more complete on all the operations that would be affected. Also, we have discussed the possibility of eliminating |
I like the ideas here and would be in favor of the strict option for the float / int case. I think its easy enough to work around if that's really what you want and would enforce more consistent behavior within our own library |
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.
Looks good!
is the intention to follow for other routines which can change dtype (either other pdep or as a follow up) eg fillna, where? |
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.
I'm happy to contribute to pandas (and pandas-stubs) and will voice my opinion when I have a strong one, but I wouldn't mind forfeiting my voting privileges.
Restricting the voting pool to more engaged people might make voting easier. If there are/will be PDEPs where you are short on votes, please ping me (again) if I haven't voted yet.
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.
+1
+1 |
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.
+1Thanks for working on this @MarcoGorelli, very nice improvement.
Just two minor comments. When this is implemented, I'd provide in the error message how to change the type of the column (it's not present in the sample error message in the abstract).
About setting float in an int column, of the 3 listed options I'd go with 1 too, but I think another option to always raise should be available, and that would be my preference. Technically floats are approximations, and the concept of the decimal part being 0 is not accurate, which brings questions about which precision to use. No big deal, happy to move forward with option 1 too, and see this PDEP move forward which will be a great improvement. But something to consider during implementation and for the future.
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.
Added one comment. There are some other comments I've made that are still unresolved.
+1 |
+1 |
Right, that's 12 upvotes, and no downvotes. Lot's of great discussion here, thanks all for the attention to detail, much appreciated! Merging this today then |
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.
+1
PDEP-6: Ban upcasting in setitem-like operations (pandas-dev#50424) --------- Co-authored-by: MarcoGorelli <> Co-authored-by: Joris Van den Bossche <[email protected]> Co-authored-by: Irv Lustig <[email protected]>
Original discussion: #39584
Turning into a PDEP as I think the
int -> float
warrants some care