Currently my dates are formatted as a string. I was able to get the string converted to date time using the following:
df['submitted_on'] = df['submitted_on'].apply(lambda x: dt.datetime.strptime(x, '%Y-%m-%d %H:%M:%S.%f'))
I would like to remove the time stamp, but I am having an awfully difficult time doing so. My preferred format is %Y%m%d
. So I stumbled upon THIS page and added .date()
. Resulting in below:
df['submitted_on'] = df['submitted_on'].apply(lambda x: dt.datetime.strptime(x, '%Y%m%d').date())
I am getting this value error and I am again lost at what to do to drop the time stamp. Any help is greatly appreciated.
ValueError: time data '2015-02-26 16:45:36.0' does not match format '%Y%m%d'