I have a dataframe that has a timestamp column as shown below:
0 2016-10-26T00:26:35+00:00
1 2016-10-26T00:26:44+00:00
2 2016-10-26T00:26:37+00:00
3 2016-10-26T00:26:27+00:00
4 2016-10-26T00:26:32+00:00
5 2016-10-26T00:26:37+00:00
6 2016-10-26T00:26:42+00:00
7 2016-10-26T00:26:42+00:00
8 2016-10-26T00:26:45+00:00
9 2016-10-26T00:26:46+00:00
10 2016-10-26T00:26:42+00:00
11 2016-10-26T00:26:46+00:00
12 2016-10-26T00:26:52+00:00
13 2016-10-26T00:26:56+00:00
14 2016-10-26T00:27:00+00:00
15 2016-10-26T00:27:03+00:00
16 2016-10-26T00:27:06+00:00
17 2016-10-26T00:18:28+00:00
18 2016-10-26T00:18:28+00:00
19 2016-10-26T00:18:35+00:00
20 2016-10-26T00:18:31+00:00
21 2016-10-26T00:18:27+00:00
22 2016-10-26T00:18:34+00:00
23 2016-10-26T00:18:43+00:00
24 2016-10-26T00:18:43+00:00
25 2016-10-26T00:18:43+00:00
26 2016-10-26T00:18:50+00:00
27 2016-10-26T00:19:02+00:00
28 2016-10-26T00:19:05+00:00
29 2016-10-26T00:18:39+00:00
I wanted to convert the column to the appropriate time type so that the time could be used later. I tried to use pd.to_datetime(df['time'], unit='s', utc=True)but got an error message:
ValueError: non convertible value 2016-10-26T00:26:35+00:00with the unit 's'
So the question is, what is the right way to do this conversion? Thank!
source
share