Reputation: 1071
So I have a bunch of data that has timestamps in python epoch time format, however using this to_datetime() function returns ValueError: unconverted data remains: 00
Here's the code
import pandas as pd
print pd.to_datetime('1451080800', format='%Y%m%d')
What's going wrong here ?
Upvotes: 0
Views: 225
Reputation: 139162
Since you say it is epoch time, I think you want this:
In [44]: pd.to_datetime(int('1451080800'), unit='s')
Out[44]: Timestamp('2015-12-25 22:00:00')
Note the int(..)
around the string. When specifying a unit
(epoch is in seconds since 1970), the argument needs to be an integer.
Upvotes: 2