0

I'm trying to datetime a column of a dataframe. But I skip this mistake, I read the documentation of datetime and I don't understand what the problem is.

datetime.strptime('Oct 22 2019 12:58:45:196AM', '%b %d %Y %H:%M:%S:%f%p')
jezrael
  • 822,522
  • 95
  • 1,334
  • 1,252

1 Answers1

0
USE this one there is no need to any format
>>> from dateutil import parser
>>> s= '25 April, 2020, 2:50, pm, IST'
>>> parser.parse(s)
>>> datetime.datetime(2020, 4, 25, 14, 50)
Amit Kumar
  • 619
  • 7
  • 10
  • This isn't really solving the problem. We don't know where the input will be coming from and should not change it (in not trivial ways) just like that. – Faboor Apr 28 '20 at 14:55