Skip to content

ENH: Using built-in round on a series #11763 #11809

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

Merged
merged 1 commit into from
Dec 15, 2015

Conversation

Dr-Irv
Copy link
Contributor

@Dr-Irv Dr-Irv commented Dec 9, 2015

closes #11763

This contains changes to support round() (works in Python 3 only) for DataFrame, Series and Panel. Also includes Panel.round(). Note on code changes - moved code from test_format.py to test_frame.py because it made more logical sense to put the testing code for round() into test_frame.py

@@ -81,6 +82,17 @@ In addition, ``.round()`` will be available thru the ``.dt`` accessor of ``Serie
s = Series(dr)
s
s.dt.round('D')

Built-in round() support
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a single line in the enhancements section is enough

@jreback jreback added Enhancement Numeric Operations Arithmetic, Comparison, and Logical operations labels Dec 10, 2015
# Dispatch to numpy.round
new_cols = [np.round(v, decimals) for _, v in self.iteritems()]
# Dispatch to Series.round
new_cols = [v.round(decimals) for _, v in self.iteritems()]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is fine, but not really necessary as these do the same thing

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, this change was needed to get rid of the out argument. If DataFrame.round() calls np.round(), then np.round() dispatches to Series.round(), passing the out argument.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

@jreback jreback added this to the 0.18.0 milestone Dec 11, 2015
@jreback
Copy link
Contributor

jreback commented Dec 11, 2015

small docs changes. pls squash. ping when green.

@Dr-Irv
Copy link
Contributor Author

Dr-Irv commented Dec 15, 2015

@jreback It's squashed now. Not sure what to do next to force the Travis CI thing to happen since it says there are conflicts

@jreback
Copy link
Contributor

jreback commented Dec 15, 2015

you need to rebase on master as well

@Dr-Irv Dr-Irv force-pushed the rounding branch 2 times, most recently from 8ef0a17 to b21bde4 Compare December 15, 2015 18:49
@Dr-Irv
Copy link
Contributor Author

Dr-Irv commented Dec 15, 2015

@jreback I think this is good to go.

@@ -444,7 +444,7 @@ def test_abs(self):
assert_series_equal(result2, expected)
self.assertEqual(result.name, 'A')
self.assertEqual(result2.name, 'A')

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete this line

@jreback
Copy link
Contributor

jreback commented Dec 15, 2015

couple of trivial changes. ping when pushed (as its already green)

@Dr-Irv
Copy link
Contributor Author

Dr-Irv commented Dec 15, 2015

@jreback pushed those changes (and squashed them as well)

@Dr-Irv
Copy link
Contributor Author

Dr-Irv commented Dec 15, 2015

@jreback last build failed due to a URL issue. Not sure how to restart the run

jreback added a commit that referenced this pull request Dec 15, 2015
ENH: Using built-in round on a series #11763
@jreback jreback merged commit 22f0c7e into pandas-dev:master Dec 15, 2015
@jreback
Copy link
Contributor

jreback commented Dec 15, 2015

@Dr-Irv no worries. thanks for this!

yeh travis fails once in a while on the build step.

@Dr-Irv Dr-Irv deleted the rounding branch December 9, 2016 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Numeric Operations Arithmetic, Comparison, and Logical operations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ENH: Using built-in round on a series
2 participants