Problem with pandas.lib.Timestamp in pandas 0.8.2.dev-4083689

109 views
Skip to first unread message

Aquil H. Abdullah

unread,
Aug 28, 2012, 11:37:56 AM8/28/12
to pystat...@googlegroups.com
Hello,

I was trying to determine the first_valid_index of a pandas.Series using, pandas 0.8.2.dev-4083689. The answer that I should have received was:
1983-05-09 00:00:00.

However, the answer that I did receive was1905-05-30 09:45:04.680312

The problem appears to be in pandas.lib.Timestamp. In the DatetimeIndex class the __getitem__ method has a line of code:

            return Timestamp(val, offset=self.offset, tz=self.tz)

which is returning the wrong value. The code below reproduces the problem.

import pandas
import numpy as np
print 'using pandas: ', pandas.__version__
print 'using numpy:', np.__version__

d = np.datetime64('1983-05-19T20:00:00.000000000-0400')
ts = pandas.lib.Timestamp(d)
print 'numpy.datetime64:', d
print 'Timestamp:', ts 

Anyway, here the results:

using pandas:  0.8.2.dev-4083689
using numpy: 1.7.0.dev-0c5f480
numpy.datetime64: 1983-05-19T20:00:00.000000000-0400
Timestamp: 1905-05-30 09:45:04.680312

I am doing something wrong or should I file this as a bug?

-- 
Aquil H. Abdullah
"I never think of the future. It comes soon enough" - Albert Einstein

Wes McKinney

unread,
Aug 28, 2012, 11:58:16 AM8/28/12
to pystat...@googlegroups.com
hi Aquil,

your development version of NumPy has an ABI (binary) backwards
compatibility (with NumPy 1.6.1) bug that was fixed/merged into NumPy
git master on or about June 5. If you upgrade NumPy and do a clean
install of pandas the bug should go away. On my system I get:

using pandas: 0.8.2.dev-95f30ca
using numpy: 1.6.1
numpy.datetime64: 1983-05-20 00:00:00
Timestamp: 1983-05-20 00:00:00

- Wes

Aquil H. Abdullah

unread,
Aug 28, 2012, 12:00:46 PM8/28/12
to pystat...@googlegroups.com
Thanks Wes, I figured it was something along the lines of a dirty environment.

-- 
Aquil H. Abdullah
"I never think of the future. It comes soon enough" - Albert Einstein

Aquil H. Abdullah

unread,
Aug 28, 2012, 6:01:31 PM8/28/12
to pystat...@googlegroups.com
So after an afternoon of trying to recompile everything from scratch in my virtual env. I finally got things to work by downgrading to numpy-6.2. I am not sure if that was the issue or if there were other problems with my virtualenv, anyway. Problem solved. Thanks.


-- 
Aquil H. Abdullah
"I never think of the future. It comes soon enough" - Albert Einstein

Reply all
Reply to author
Forward
0 new messages