pydata/pandas — pull request #6021 by danbirken (2014-01-21 02:13:15+00:00)
Title: Infer datetime format

References #5490

Basically this attempts to figure out the the datetime format if given a list of datetime strings. If the format can be guessed successfully, then to_datetime() attempts to use a faster way of processing the datetime strings.

Here is a gist that shows some timings of this function: https://gist.github.com/danbirken/8533199

If the format can be guessed, this generally speeds up the processing by 10x. In the case where the format string is guessed to be an iso8601 string or subset of that, then the format is *not* used, because the iso8601 fast-path is much faster than this (about 30-40x faster).

I just did a pretty basic way of guessing the format using only dateutil.parse, a simple regex and some simple logic. This doesn't use any private methods of dateutil. It certainly can be improved, but I wanted to get something started first before I went crazy having to handle more advanced cases.