-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
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
Conversation
@@ -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 |
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.
just a single line in the enhancements section is enough
# 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()] |
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.
this is fine, but not really necessary as these do the same thing
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.
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.
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.
ok
small docs changes. pls squash. ping when green. |
@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 |
you need to rebase on master as well |
8ef0a17
to
b21bde4
Compare
@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') | |||
|
|||
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.
delete this line
couple of trivial changes. ping when pushed (as its already green) |
@jreback pushed those changes (and squashed them as well) |
@jreback last build failed due to a URL issue. Not sure how to restart the run |
ENH: Using built-in round on a series #11763
@Dr-Irv no worries. thanks for this! yeh travis fails once in a while on the build step. |
closes #11763
This contains changes to support
round()
(works in Python 3 only) for DataFrame, Series and Panel. Also includesPanel.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 forround()
into test_frame.py