Speedup conversion of 2 million rows of date strings to POSIX.ct

后端 未结 2 1635
星月不相逢
星月不相逢 2020-12-09 11:31

I have a csv which includes about 2 million rows of date strings in the format:

2012/11/13 21:10:00 

Lets call that csv$Date.and.Time

相关标签:
2条回答
  • 2020-12-09 11:54

    You want the small and simple fasttime package by Simon which does this in the fastest possible way---by not calling time parsing functions but just using C-level string functions.

    It does not support as many formats as strptime. In fact, it doesn't even have a format string. But well-formed ISO format variants, that is yyyy-mm-dd hh:mm:ss.fff will work, and your / separator may just work too.

    0 讨论(0)
  • 2020-12-09 11:59

    Try using lubridate - it does all date time parsing using regular expressions, so not only is it much faster, it's also much more flexible.

    0 讨论(0)
提交回复
热议问题