I wouldn't bother with this loop. Maybe this will work? Just get a list of all the columns that the first pandas pass set the type of to "object", then pass all of those to the parse_dates param in pandas.read_csv() below. Some of them will just come out as "object" again if pandas couldn't detect dates. But some of them will come out as dates.

Maybe there is a way to do it without calling pandas.read_csv() twice, for example can you take each of the "object" columns and pass them to some other pandas function that will try to parse just those columns as dates?

If you do have to call read_csv() twice though, maybe you could read the file in from disk once in Python and keep the contents in a variable (remember we're restricting the size of the files at upload time, so not too worried about running out of memory here). Then you can make an in-memory file-like object with `StringIO.StringIO(file_contents)` and pass that object to read_csv(). You have to make a second StringIO of the same contents to pass it to read_csv() the second time, as I think they're one-time-use-only.

I don't think we need to be overly concerned about efficiency here anyway, more important that it works and the code is clear and simple.