Good morning,
My script reads a csv
with various columns. In the pandas function read_csv
reads:
data = pd.read_csv(filepath, index_col='Target', parse_dates=True, infer_datetime_format=True)
The dataframe
looks like this:
Target Observer StartTime StopTime
Target1 RT1 2019-09-01 20:47:50.02 2019-09-01 20:57:50.02
But the dtypes
that it gives me are:
Observer object
StartTime object
Stoptime object
I need to take the duration of each observation, and then other operations in which I need to be able to deal with the dates (i.e: see how long it takes for the next observation or lead(StartTime) - StopTime
to appear).
I can not pass in any way StartTime
and StopTime
to datetime
to operate better with them.
I've tried pd.to_datetime()
and other functions and they do not work.
Any ideas?
Thanks in advance!