In numpy 1.6.1, what's the most straightforward way to convert a datetime64 to a python datetime.datetime?  E.g. I have<br><br><span style="font-family: courier new,monospace;">In [1]: d = datetime64("2011-12-03 12:34:56.75")</span><br style="font-family: courier new,monospace;">

<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">In [2]: d</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">Out[2]: 2011-12-03 12:34:56.750000</span><br>

<br>I want the same time as a datetime.datetime instance.  My best hack so far is to parse repr(d) with datetime.datetime.strptime:<br><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">In [3]: import datetime</span><br style="font-family: courier new,monospace;">

<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">In [4]: dt = datetime.datetime.strptime(repr(d), "%Y-%m-%d %H:%M:%S.%f")</span><br style="font-family: courier new,monospace;">

<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">In [5]: dt</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">Out[5]: datetime.datetime(2011, 12, 3, 12, 34, 56, 750000)</span><br>

<br>That works--unless there are no microseconds, in which case ".%f" must be removed from the format string--but there must be a better way.<br><br>Warren<br><br>