Reputation: 1801
I have a dataframe with the following columns:
0 Pressure [bar] Temperature [C]
0 13:07:46.380: 30.0911 11.8
1 13:07:47.332: 30.0940 11.8
2 13:07:50.998: 30.0911 11.8
I want to convert the first column to a proper datetime, so I've tried:
df2['Time'] = pd.to_datetime(df2[0],format='%H:%M:%S.%f:')
But the result I got was:
0 Pressure [bar] Temperature [C] Time
0 13:07:46.380: 30.0911 11.8 1900-01-01 13:07:46.380
1 13:07:47.332: 30.0940 11.8 1900-01-01 13:07:47.332
2 13:07:50.998: 30.0911 11.8 1900-01-01 13:07:50.998
Which is obviously not what I wanted, I want it to be just the time, meaning:
Pressure [bar] Temperature [C] Time
0 30.0911 11.8 13:07:46.380
1 30.0940 11.8 13:07:47.332
2 30.0911 11.8 13:07:50.998
And using the Time column as an index.
Any ideas?
Thank you!
Upvotes: 0
Views: 62