I think this is a simple problem, but I am struggling tremendously... I need to subtract two datetimes. One is naive and one is aware but I can not for the life of me convert one to the other.
How do I convert one of these datetimes to the other to allow subtraction?
Example code below:
now_time = str(pd.Timestamp("now"))
current_time = datetime.strptime(now_time, "%Y-%m-%d %H:%M:%S.%f")
x = df.at[0,1]
x = datetime.strptime(x, "%Y-%m-%d %H:%M:%S.%f%z")
print(current_time)
print(x)
print(current_time-x)
returns
2020-04-06 19:29:58.239641
2020-04-06 22:50:22.577561+00:00
Traceback (most recent call last):
File "main.py", line 416, in <module>
print(current_time-x)
TypeError: can't subtract offset-naive and offset-aware datetimes