-
-
Notifications
You must be signed in to change notification settings - Fork 18.2k
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
Regression in 0.24: to_timedelta handling of float values #25077
Comments
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.
|
Sorry, was in the process of doing it! |
Thanks. Likely some rounding issue. Are floating point values allowed in |
Feel free to change milestone depending on what your thoughts on this are. |
It's not really documented very clearly (under pandas/pandas/tests/indexes/timedeltas/test_tools.py Lines 104 to 108 in 5278cc6
So clearly a regression I would say. |
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. 0.23.4:
0.24.1:
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) |
are these exactly the same numpy version? this is at the precision limit |
Yes, the same numpy version apparently. But, it's only the 6th decimal, that's a precision we should be able to handle. |
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 pandas/pandas/core/arrays/timedeltas.py Lines 918 to 926 in 0eddba8
While before that PR, floats were handled by (the slower)
In the pandas/pandas/_libs/tslibs/timedeltas.pyx Lines 293 to 299 in 0eddba8
|
@Sup3rGeo it looks like @jorisvandenbossche has found the source of the issue. The quoted code in arrays.timedeltas needs to use the quoted code in tslibs.timedeltas instead of numpy's |
@jbrockmendel maybe! Will check if I can sneak this into the weekend. |
I think we're planning a 0.24.2 release for sometime next week. @Sup3rGeo do you have time to submit a PR in the next few days? |
I can also do it tomorrow afternoon, if that might help. |
Code Sample, a copy-pastable example if possible
Creating an TimedeltaIndex with 1 microsecond steps:
Problem description
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.
Expected Output
Output in 0.23.4:
In this version everything is okay.
Output of
pd.show_versions()
INSTALLED VERSIONS
commit: None
python: 3.6.7.final.0
python-bits: 64
OS: Windows
OS-release: 10
machine: AMD64
processor: Intel64 Family 6 Model 58 Stepping 9, GenuineIntel
byteorder: little
LC_ALL: None
LANG: None
LOCALE: None.None
pandas: 0.24.0
pytest: 4.1.0
pip: 18.1
setuptools: 39.0.1
Cython: 0.29.2
numpy: 1.15.4
scipy: 1.1.0
pyarrow: 0.11.1
xarray: 0.11.2
IPython: 7.2.0
sphinx: 1.8.3
patsy: None
dateutil: 2.7.5
pytz: 2018.7
blosc: 1.7.0
bottleneck: 1.2.1
tables: 3.4.4
numexpr: 2.6.9
feather: None
matplotlib: 3.0.2
openpyxl: 2.5.12
xlrd: 1.2.0
xlwt: 1.3.0
xlsxwriter: 1.1.2
lxml.etree: 4.3.0
bs4: 4.7.1
html5lib: 1.0.1
sqlalchemy: 1.2.15
pymysql: None
psycopg2: None
jinja2: 2.10
s3fs: 0.2.0
fastparquet: 0.2.1
pandas_gbq: None
pandas_datareader: None
gcsfs: None
The text was updated successfully, but these errors were encountered: