-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: fix col iteration in DataFrame.round, #11611 #11618
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
try: | ||
yield np.round(df[col], decimals[col]) | ||
yield np.round(vals, decimals[col]) |
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.
Is the decimals lookup going to have the same problem if it's not unique here?
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.
The value of decimals is either of type dict or pandas.Series. Whereas the former can not have duplicate entries, a pandas.Series might have and direct indexing will return all values with the same index. So, this case is still not handled.
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 think let's raise if decimals
is not unique (it should be a dict/Series).
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.
Had the same thought this morning.
need some tests |
pls add the test example as well (you can just smoke tests it I think; e.g. assert it runs). add a tests for passing a non-unique decimal. put this in the bug-fix section for a whatsnew entry. |
Agreed. |
# Conflicts: # doc/source/whatsnew/v0.17.1.txt
merged via 80a2d53 thanks! |
Fixes #11611. The iterator now uses DataFrame.iteritems instead of direct indexing.