Regression in 0.24: to_timedelta handling of float values #25077
Code Sample, a copy-pastable example if possible
Creating an TimedeltaIndex with 1 microsecond steps:
import pandas as pd import scipy as sp t = sp.arange(0,1,1e-6) index = pd.to_timedelta(t, unit='s')
Output in 0.24:
We have repeated index values (e.g. 99992 in the image) and missing ones (e.g. 99994 in the image).
This looks like some sort of rounding issue.
Output in 0.23.4:
In this version everything is okay.
Can you fill out the issue?…
On Feb 1, 2019, at 11:23, Victor Maryama ***@***.***> wrote: Code Sample, a copy-pastable example if possible # Your code here Problem description [this should explain why the current behaviour is a problem and why the expected output is a better solution.] Note: We receive a lot of issues on our GitHub tracker, so it is very possible that your issue has been posted before. Please check first before submitting so that we do not have to handle and close duplicates! Note: Many problems can be resolved by simply upgrading pandas to the latest version. Before submitting, please check if that solution works for you. If possible, you may want to check if master addresses this issue, but that is not necessary. For documentation-related issues, you can check the latest versions of the docs on master here: https://pandas-docs.github.io/pandas-docs-travis/ If the issue has not been resolved there, go ahead and file it in the issue tracker. Expected Output Output of pd.show_versions() — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.
this is just a precision issue.
try this to see full precision printing
not a bug / regression at all; I suppose docs could be enhanced
It's not just about display. The actual integer values have changed between 0.23 and 0.24. Before 0.24, the floats were converted to ints with a better precison.
Notice the 999997000 vs 999996999
So in any case, it is a regression in behaviour (whether we think it was supported behaviour or not can be another discussion)
Just to add to the discussion from a user application perspective:
I think this is caused by #23539. In that PR, a new code path for floats was added in
While before that PR, floats were handled by (the slower)