[Numpy-discussion] lexsort() of datetime objects doesn't work

Ernest Adrogué eadrogue@gmx....
Thu Aug 19 17:40:03 CDT 2010


Hi,

I was trying to use lexsort with an array of
datetime.date objects, but it doesn't seem to work.

In [86]: date = np.array([datetime.date(2000, 9, 17),
 datetime.date(2000, 10, 1),
 datetime.date(2000, 10, 22),
 datetime.date(2000, 11, 1)])

In [90]: date
Out[90]: array([2000-09-17, 2000-10-01, 2000-10-22, 2000-11-01], dtype=object)

In [91]: np.lexsort((date,))
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)

/home/ernest/src/footy/dataset.py in <module>()
----> 1 
      2 
      3 
      4 
      5 

TypeError: merge sort not available for item 0

The normal argsort works, however this is in a method that uses
lexsort and I can't change it without breaking things.


Ernest


More information about the NumPy-Discussion mailing list