-
-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Closed
Labels
Description
https://docs.scipy.org/doc/numpy-1.15.0/reference/generated/numpy.sort.html#numpy.sort describes how np.nan is handled for floating point data. NaT and datetime data are not mentioned.
Reproducing code example:
In the following, NaN is sorted to the end, while NaT is sorted to the start.
In [32]: arr = np.array([np.nan, 1, 2, 3])
In [33]: arr.sort(); arr
Out[33]: array([ 1., 2., 3., nan])
In [34]: dtarr = np.array(['NaT', 1, 2, 3], dtype='datetime64[ns]')
In [35]: dtarr.sort(); dtarr
Out[35]:
array([ 'NaT', '1970-01-01T00:00:00.000000001',
'1970-01-01T00:00:00.000000002', '1970-01-01T00:00:00.000000003'],
dtype='datetime64[ns]')So my question: is NaT sorting to the start a bug or deliberate? If it's deliberate, I could add a section to the docs noting that.
Numpy/Python version information:
1.16.0.dev0+9cc9f01 3.7.1 (default, Nov 6 2018, 18:45:35)
[Clang 10.0.0 (clang-1000.11.45.5)]