May-23-2021, 11:29 PM
I am pulling a csv from a database. With that the date is an object, I am attempting to convert it to be in datetime64[ns].
My code is as follows:
Any assistance would be great!
My code is as follows:
#!/usr/bin/env python __author__ = "Michael Brown" __license__ = "Based off of sript by Sreenivas Bhattiprolu of Python for Microscopists" import pandas as pd import datetime as dt from matplotlib import pyplot as plt import matplotlib CVD = pd.read_csv('https://opendata.arcgis.com/datasets/18582de727934249b92c52542395a3bf_0.csv') #print(CVD.head()) print(CVD.dtypes) CVD['DATE'] = [dt.datetime.strptime(x,'%Y/%m/%d %H:%M:%S') for x in CVD['DATE']] print(CVD.dtypes)the output is the following
ValueError: time data '2020/03/04 15:00:00+00' does not match format '%Y/%m/%d %H:%M:%S%z'I am confused what I am missing. I believe it has something to do with the +00 format for the timezone offset.
Any assistance would be great!