'How to convert str to timestamp in dataframe?

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


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source