How to convert str to timestamp in dataframe?

171 views Asked by At

I was unable to use the .weekday() method because data['Date'] is formatted as a string. However, when I tried to use a look to change data type to date it produced an error, saying it was a foat?

dates = []

for date in data['Date']:
    dtobj = datetime.strptime(date,'%Y-%m-%d')
    dates.append(dtobj)

TypeError: strptime() argument 1 must be str, not float
0

There are 0 answers