I've been working on this data set and I want to create a column for the difference between 2 dates.
df["ended_at"] = pd.to_datetime(df["ended_at"])
df["started_at"] = pd.to_datetime(df["started_at"])
df.insert(4,"trip_duration",df["ended_at"] - df["started_at"])
I tried to get rid of the "0 days" using :
df["trip_duration"] = pd.to_datetime(df["trip_duration"], format = '%H:%M:%S').dt.time
But it results in the following TypeError :
TypeError: dtype timedelta64[ns] cannot be converted to datetime64[ns]
Can you help me get rid of the "0 days" part and only keep HH:MM:SS