Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

python pandas parse datetime string with months names

Can someone point me to a format or a code snippet to parse date in format like

04SEP12:00:00:00

That %dd%mm%YY:%HH:%MM:%SS doesn't work.

like image 896
sh1ng Avatar asked Sep 01 '15 13:09

sh1ng


1 Answers

Use format string: '%d%b%y:%H:%M:%S' and pass this as the format for to_datetime, you can find the format options in the docs:

In [73]:

pd.to_datetime('04SEP12:00:00:00', format='%d%b%y:%H:%M:%S')
Out[73]:
Timestamp('2012-09-04 00:00:00')
like image 195
EdChum Avatar answered Oct 20 '22 05:10

EdChum