Skip to content

Overflow adding pd.timedelta to pd.Timestamp #6549

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

Closed
flatzo opened this issue Mar 5, 2014 · 3 comments
Closed

Overflow adding pd.timedelta to pd.Timestamp #6549

flatzo opened this issue Mar 5, 2014 · 3 comments
Labels
Bug Testing pandas testing functions or related to the test suite Timedelta Timedelta data type Windows Windows OS

Comments

@flatzo
Copy link

flatzo commented Mar 5, 2014

xref #9442

Assume following code

import pandas as pd

additions = [1e9, 1e10]
for ns in additions:
    added = pd.Timestamp(0) + pd.to_timedelta(str(ns), unit='ns')
    print added

This will work fine on Linux 64 bits. However, it won't work on Windows (both 32 and 64 bits).

As for now, the following solution works fine but is not as elegant as the API nothing tells me that Timestamp(0).value will be nanoseconds in the next versions of API

import pandas as pd

additions = [1e9, 1e10]
for ns in additions:
    added = pd.Timestamp(pd.Timestamp(0).value + ns)
    print added

I believe to know what is causing the bug, but I have no clue on how to set up the compilation environment on windows. I would suggest to change the astype(int) to astype(long) on the following line :

https://github.com/pydata/pandas/blob/v0.13.1/pandas/tslib.pyx#L659

Anybody could try that fix or giving me insight on how to setup compilation environement on windows so I could try it myself.

@jreback
Copy link
Contributor

jreback commented Mar 5, 2014

see this to setup on windows - its not too difficult - #5561
lmk how it goes

@jreback jreback added this to the 0.14.0 milestone Mar 5, 2014
@jreback jreback modified the milestones: 0.15.0, 0.14.0 Apr 21, 2014
@jreback jreback modified the milestones: 0.16.0, Next Major Release Mar 3, 2015
@jreback
Copy link
Contributor

jreback commented Mar 17, 2015

xref #9442 (this is a conversion issue)

@jreback jreback closed this as completed Mar 17, 2015
@jreback jreback reopened this Mar 17, 2015
@jreback jreback modified the milestones: 0.16.1, Next Major Release Mar 17, 2015
@jreback jreback modified the milestones: 0.17.0, 0.16.1 Apr 28, 2015
@jreback jreback modified the milestones: Next Major Release, 0.17.0 Aug 15, 2015
@jreback
Copy link
Contributor

jreback commented Aug 29, 2015

this has been fixed quite a while ago. If you still experience issues, pls reopen. (you will need pandas >= 0.15.0)

@jreback jreback closed this as completed Aug 29, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Testing pandas testing functions or related to the test suite Timedelta Timedelta data type Windows Windows OS
Projects
None yet
Development

No branches or pull requests

2 participants