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

train['date1'] = train['ID'].apply(lambda x: datetime.strptime(x, '%Y%m%d%H'))

Here is what the above code is Doing:
1. We’re creating a new column called ‘date1’ in the train dataframe.
2. We’re using the apply function to apply the datetime.strptime function to the ID column of the train dataframe.