-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Series.rank() doesn't handle small floats correctly #6868
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
The reason is here: https://github.com/pydata/pandas/blob/master/pandas/algos.pyx#L9 where any number below As you demonstrated, it seems |
How about replacing these comparisons with something like what numpy.isclose() does? http://docs.scipy.org/doc/numpy/reference/generated/numpy.isclose.html For my particular situation, I could easily roll something that does what I think is correct (in my case a log transformation would work fine), but people should be able to trust the output of the algorithms built-in to pandas -- 1e-13 seems to be very arbitrary and I'm sure I'm not the only person who uses floats that are substantially closer to zero than that. I think using a relative tolerance is much more flexible than the absolute tolerance currently being used here by pandas. (As a note, numpy.testing.assert_allclose uses a relative tolerance of 1e-07 and an absolute tolerance of 0). On Apr 11, 2014, at 6:48 AM, Dan Allan wrote:
|
I agree that would be better. But let's get the blessing of one of the Collaborators before anyone puts effort in.... @jreback? |
I don't really know why this was put in the first place welcome tey to change and see what happens |
we just want to keep performance in mind here. Noah, if you could put |
…ndas-dev#6868 cleaning up comments BUG: Series/DataFrame.rank() doesn't handle small floats correctly pandas-dev#6868 adding test for ranking with np.inf Added release note pandas-dev#6886 Fixing float conversions in test_rank()
adding test for ranking with np.inf Added release note #6886 Fixing float conversions in test_rank()
closed via #6886 |
…ndas-dev#6868 adding test for ranking with np.inf Added release note pandas-dev#6886 Fixing float conversions in test_rank()
Floats below 1e-10 seem to all be receiving the same rank, incorrectly:
The text was updated successfully, but these errors were encountered: