-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
ENH: Using built-in round on a series #11763
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
Comments
sure you could define that to call the |
@jreback I would be happy to send a PR for this. |
@jreback Thanks! |
@jreback So I have something that works fine with Python 3, but Python 2 presents a problem because in Python 2, round(class) doesn't call class.round() . In other words, you can't easily override the built-in round() behavior in Python 2. I'm not sure of the best way to handle this. I could just avoid the round() test in the testing code when doing a Python 2 test and we don't worry about supporting round(DataFrame) with Python 2. Other suggestions welcome. |
Python 2.7.10 |Continuum Analytics, Inc.| (default, Oct 19 2015, 18:31:17) Obviously you wouldn't actually call
|
@jreback I don't think your example applies, because we want round(DataFrame) to work correctly, and your example worked OK because you were subclassing a float object. If you changed |
@Dr-Irv ok, that IS an ugly hack. So just test this on PY3, that is fine. This is really just a convenience feature anyhow, it really breaks up the flow, but if people really want to use it then it would work e.g.
|
ENH: Using built-in round on a series #11763
Is there some philosophical reason that round(Series) and round(Dataframe) is not defined? See the example below. Being able to write round() as a function of a Dataframe or Series, as opposed to doing it afterwards would be nice. I'm willing to implement
__round__()
to make it work, but don't want to go down that path if there is some reason__round__()
is not implemented.Example:
Produces
The text was updated successfully, but these errors were encountered: