Sort a pandas dataframe based on DateTime field
<p>I am trying to sort a dataframe based on DateTime field which is of datatype datetime64[ns].</p>

<p>My dataframe looks like this:</p>

<pre><code>Name    DateTime1
P38     NaT
P62     2016-07-13 16:03:32.771
P59     2016-06-23 14:23:42.461
P07     NaT
P16     2016-06-23 14:02:06.237
P06     2016-07-13 16:03:52.570
P106    2016-07-13 19:56:22.676
</code></pre>

<p>When I sort it using DateTime field, </p>

<pre><code>df.sort_values(by='DateTime1',ascending=True)
</code></pre>

<p>I do not get the desired result. </p>

<p>Output:</p>

<pre><code>Name    DateTime1
P16     2016-06-23 14:02:06.237
P59     2016-06-23 14:23:42.461
P62     2016-07-13 16:03:32.771
P06     2016-07-13 16:03:52.570
P106    2016-07-13 19:56:22.676
P38     NaT
P07     NaT
</code></pre>