I am attempting to following the steps in Pandas: add timedelta column to datetime column (vectorized) to add a time delta column to my dataframe by converting a'pandas._libs.tslibs.timestamps.Timestamp' series.
Code:
df = pd.DataFrame([['2020-07-25 09:26:28',2],['2020-07-25 09:26:2',10],['2020-07-25 09:26:30',203],['2020-07-25 09:26:31',30]],
columns = ['Time','Load'])
df['Time'] = pd.to_datetime(df['Time'])
print(df)
print(type(df["Time"][0]))
df_static['time_delta'] = pd.to_timedelta(df_static['Time'])
However, I get the following error:
TypeError: dtype datetime64[ns] cannot be converted to timedelta64[ns]
What am I doing wrong?