question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Regression in 0.24: to_timedelta handling of float values

See original GitHub issue

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:

image

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:

image

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

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:15 (15 by maintainers)

github_iconTop GitHub Comments

1reaction
Sup3rGeocommented, Feb 1, 2019

Sorry, was in the process of doing it!

0reactions
jorisvandenbosschecommented, Mar 6, 2019

I can also do it tomorrow afternoon, if that might help.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Whats new in 0.24.2 (March 12, 2019) — pandas 0.25.3 ...
Fixed regression in to_timedelta() losing precision when converting floating data to Timedelta data (GH25077). Fixed pip installing from source into an ...
Read more >
Convert date to float for linear regression on Pandas data frame
I want to perform linear regression of how sales depend on date (as time moves forward, how do sales move?). The problem with...
Read more >
Changelog — lifelines 0.27.4 documentation
Parametric Cox models can now handle left and interval censoring datasets. ... (and bug fix) scalar parameters in regression models were not being...
Read more >
What's new in 0.24.0 (January 25, 2019) - Pandas 中文
This is a major release from 0.23.4 and includes a number of API changes, new features, enhancements, and performance improvements along ...
Read more >
mne.Evoked — MNE 0.24.1 documentation - MNE-Python
Dataset ID number (int) or comment/name (str). Optional if there is only one data set in file. projbool, optional. Apply SSP projection ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found