How to handle microseconds with 7 decimal precision instead of 6
<p>I am processing a csv in <code>python</code> (3.5) that has a date field in it.  The date contains a microsecond precision of 7 rather than 6, which I believe is the max that <code>strptime</code> can handle.  </p>

<p>Without stripping the field the last character, is there a way to make this a datetime object?</p>

<p>Here is the specific code: </p>

<pre><code>d = '2015-07-03 17:29:34.5940379'
pd.datetime.strptime(d, '%Y-%m-%d %H:%M:%S.%f')
ValueError: unconverted data remains: 9
</code></pre>

<p>If that's the format your numbers are in, just use <code>pd.to_timestamp(d)</code></p>

<p>datetime.datetime objects only have microsecond resolution (6 digits), but <a href="http://pandas.pydata.org/pandas-docs/stable/timeseries.html#converting-to-timestamps" rel="nofollow">Pandas Timestamps</a> are Numpy datetime64 objects.</p>

python strptime