Keith Hubbard
Keith Hubbard

Reputation: 1

Issue with datetime after updating packages

I've updated to python 3.12.4 and I'm getting an error on the code:

test=pd.DataFrame(['2024-09-10 15:40:27+00:00','2024-09-10 18:13:50.201000+00:00']) 
pd.to_datetime(test[0]).dt.tz_localize(None) 

The error states:

ValueError: time data "2024-09-10 15:40:27+00:00" doesn't match format "%Y-%m-%d %H:%M:%S.%f%z", at position 653.

I don't get this error on my laptop with an older python.

I've tried adding format='ISO8601' but this causes problems for my older code (which I still need).

How can I get it to work on both?

Upvotes: 0

Views: 46

Answers (0)

Related Questions