Skip to content
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

BUG: overflow on pd.Timedelta(nanoseconds=) constructor #32402

Closed
jreback opened this issue Mar 2, 2020 · 0 comments · Fixed by #32424
Closed

BUG: overflow on pd.Timedelta(nanoseconds=) constructor #32402

jreback opened this issue Mar 2, 2020 · 0 comments · Fixed by #32424
Labels
Bug Timedelta Timedelta data type
Milestone

Comments

@jreback
Copy link
Contributor

jreback commented Mar 2, 2020

In [1]: pd.__version__                                                                                                                                                                                                      
Out[1]: '1.1.0.dev0+570.g9a02c3503

It appears we are overflowing when using nanoseconds= keyword for Timedelta. This works just fine when passing smaller values or passing as the first positional arg.

In [3]: pd.Timedelta(nanoseconds=1e10)                                                                                                                                                                                      
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-3-d56d2f0a71ff> in <module>
----> 1 pd.Timedelta(nanoseconds=1e10)

~/pandas/pandas/_libs/tslibs/timedeltas.pyx in pandas._libs.tslibs.timedeltas.Timedelta.__new__()

ValueError: Could not convert object to NumPy timedelta

# ok if by default constructor
In [4]: pd.Timedelta(1e10)                                                                                                                                                                                                  
Out[4]: Timedelta('0 days 00:00:10')
@jreback jreback added Bug Timedelta Timedelta data type labels Mar 2, 2020
@jreback jreback added this to the Contributions Welcome milestone Mar 2, 2020
@jreback jreback modified the milestones: Contributions Welcome, 1.1 Mar 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Timedelta Timedelta data type
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant