-
Notifications
You must be signed in to change notification settings - Fork 901
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
[FEA] Expose libcudf column round in Python #1270
Comments
It looks like the In [1]: import cudf
In [2]: df = cudf.DataFrame({'x': [1.2345, 6.7890]})
In [3]: print(df)
x
0 1.2345
1 6.789
In [4]: print(df // 0.01 * 0.01)
x
0 1.23
1 6.78
In [5]: df.to_pandas().round(2)
Out[5]:
x
0 1.23
1 6.79 |
Floor division will work often but doesn't resolve the discrepancies shown when you should be rounding up for that place. |
@beckernick I think the reason that C/C++ doesn't have a round(x, decimals) to round floating point values to a number of decimal points is because binary floating point numbers don't have decimals, by definition. Rounding can lead to unrepresentable values and thus result in less accuracy than the decimals parameter suggests... In C++, people usually round on printing, rather than changing the stored value. But if you insist... |
Yeah, there are lots of technical reasons to not round. It's good to remind ourselves that our users aren't technical, and don't care about those reasons :) |
I wonder how often users round their data and then complain that the results are wrong. However, I think it's unfair to call users of tools like Python and Pandas non-technical... |
I believe this is now ready, based on discussion with @codereport in #6976 @ChrisJar would you be able to explore plumbing cudf::round up to python and removing the old numba.cuda round code? |
Thanks for digging up this old issue, @beckernick , I forgot about it! Retitled this and relabeled it to reflect that it is a Python feature request now, since the libcudf feature is implemented. Note that this allows us to remove some Numba code. See #6976 (comment) |
Yeah, would love to work on this |
Thanks! |
This enables round for DataFrames and Series using the libcudf round implementation and removes the old numba round implementation. Closes #1270 Authors: - @ChrisJar Approvers: - Ashwin Srinath (@shwina) - Michael Wang (@isVoid) - Ram (Ramakrishna Prabhu) (@rgsl888prabhu) - GALI PREM SAGAR (@galipremsagar) URL: #7022
Is your feature request related to a problem? Please describe.
As a user, I'd like to be able to round a Series to a specified number of decimal places, like in Pandas.
Describe the solution you'd like
I'd like to call
series.round(n)
and round the values in the series ton
decimal places.Describe alternatives you've considered
The alternative is to define a rounding UDF or go to the CPU.
Additional context
Add any other context, code examples, or references to existing implementations about the feature request here.
The text was updated successfully, but these errors were encountered: