The fastest way to parse dates in Python when reading .csv file?
<p>I have a .csv file that has 2 separate columns for <code>'Date'</code> and <code>' Time'</code>. I read the file like this:</p>

<pre><code>data1 = pd.read_csv('filename.csv', parse_dates=['Date', 'Time'])
</code></pre>

<p>But it seems that only the <code>' Date'</code> column is in time format while the <code>'Time'</code> column is still string or in a format other than time format.</p>

<p>When I do the following:</p>

<pre><code>data0 = pd.read_csv('filename.csv')
data0['Date'] = pd.to_datetime(data0['Date'])
data0['Time'] = pd.to_datetime(data0['Time'])
</code></pre>

<p>It gives a dataframe I want, but takes quite some time.
So what's the fastest way to read in the file and convert the date and time from a string format?</p>

<p>The .csv file is like this:</p>

<pre><code>              Date      Time      Open       High       Low     Close  
0       2004-04-12    8:31 AM  1139.870  1140.860  1139.870  1140.860       
1       2005-04-12   10:31 AM  1141.219  1141.960  1141.219  1141.960       
2       2006-04-12   12:33 PM  1142.069  1142.290  1142.069  1142.120       
3       2007-04-12    3:24 PM  1142.240  1143.140  1142.240  1143.140       
4       2008-04-12    5:32 PM  1143.350  1143.589  1143.350  1143.589       
</code></pre>

<p>Thanks!</p>