Skip to content
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: fix col iteration in DataFrame.round, #11611 #11618

Closed
wants to merge 4 commits into from
Closed

BUG: fix col iteration in DataFrame.round, #11611 #11618

wants to merge 4 commits into from

Conversation

skycaptain
Copy link
Contributor

Fixes #11611. The iterator now uses DataFrame.iteritems instead of direct indexing.

try:
yield np.round(df[col], decimals[col])
yield np.round(vals, decimals[col])
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

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).

Copy link
Contributor Author

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.

@jreback
Copy link
Contributor

jreback commented Nov 16, 2015

need some tests

@jreback jreback added Bug Reshaping Concat, Merge/Join, Stack/Unstack, Explode Compat pandas objects compatability with Numpy or Python functions labels Nov 18, 2015
@jreback
Copy link
Contributor

jreback commented Nov 18, 2015

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.

@skycaptain
Copy link
Contributor Author

Agreed.

@jreback jreback added this to the 0.17.1 milestone Nov 20, 2015
jreback pushed a commit that referenced this pull request Nov 20, 2015
BUG: decimals must be unique indexed, #11618

BUG: Added test, added whatsnew entry, #11618

TST: move round testing to test_format.py
@jreback
Copy link
Contributor

jreback commented Nov 20, 2015

merged via 80a2d53

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Compat pandas objects compatability with Numpy or Python functions Reshaping Concat, Merge/Join, Stack/Unstack, Explode
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants