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

2010-08-20 Thread Ernest Adrogué
19/08/10 @ 18:03 (-0600), thus spake Charles R Harris: > 2010/8/19 Ernest Adrogué > > > 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), >

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

2010-08-19 Thread Charles R Harris
2010/8/19 Ernest Adrogué > 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

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

2010-08-19 Thread Ernest Adrogué
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

Re: [Numpy-discussion] lexsort

2008-05-06 Thread Eleanor
Anne Archibald gmail.com> writes: > > It appears that lexsort is broken in several ways, and its docstring > is misleading. > > First of all, this code is not doing quite what you describe. The > primary key here is the [5,6,7,8] column, followed by the middle and > then by the first. This is a

Re: [Numpy-discussion] lexsort

2008-05-06 Thread Anne Archibald
2008/5/6 Eleanor <[EMAIL PROTECTED]>: > >>> a = numpy.array([[1,2,6], [2,2,8], [2,1,7],[1,1,5]]) > >>> a > array([[1, 2, 6], >[2, 2, 8], >[2, 1, 7], >[1, 1, 5]]) > >>> indices = numpy.lexsort(a.T) > >>> a.T.take(indices,axis=-1).T > array([[1, 1, 5], >[1, 2, 6],

[Numpy-discussion] lexsort

2008-05-06 Thread Eleanor
>>> a = numpy.array([[1,2,6], [2,2,8], [2,1,7],[1,1,5]]) >>> a array([[1, 2, 6], [2, 2, 8], [2, 1, 7], [1, 1, 5]]) >>> indices = numpy.lexsort(a.T) >>> a.T.take(indices,axis=-1).T array([[1, 1, 5], [1, 2, 6], [2, 1, 7], [2, 2, 8]]) The above does what I w