Overflow adding pd.timedelta to pd.Timestamp · Issue #6549 · pandas-dev/pandas (original) (raw)

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.