pandas: Regression in 0.24: to_timedelta handling of float values
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')
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()
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
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 15 (15 by maintainers)
Sorry, was in the process of doing it!