-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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
DataFrame.to_records converts dates wrongly #1908
Comments
>>> pandas.__version__
'0.9.0.dev-a83e691'
>>> numpy.__version__
'1.6.2' |
I have found that converting the index to Python datetime values (using |
It's a display/repr issue in NumPy 1.6 unfortunately. The actual nanosecond timestamps have not been altered |
I am pretty sure this is not simply a display/repr issue. See the following output: >>> recs[0][0]
1970-01-16 224:00:00
>>> recs[0][0].astype(datetime.datetime)
datetime.datetime(1970, 1, 16, 224, 0) I noticed this problem while trying to convert a DataFrame object into a PostgreSQL table using the |
All caused by the same NumPy 1.6 bug. Maybe a solution is to add an option to |
+1 |
A new contributor who can reproduce this on their system should be able to write an implementation of this fairly quickly. (They would need to have a buggy version of NumPy, which may be very common! Otherwise, they would need to be familiar with 'pip' or other ways of installing/changing the version of NumPy installed.) A question: should skipping NumPy be the default mode? It should be possible to write a test case that checks that NumPy is skipped with the new argument to to_records, so it seems to me that the pull request should include a test. |
Possibly related to #1720:
When converting a DataFrame to a recarray using
df.to_records
, date indexes are incorrectly converted.Notice the dates have been converted to 1970, even though the original dates were in 2012.
The text was updated successfully, but these errors were encountered: