[Numpy-discussion] Type specific sorts: objects, structured arrays, and all that.

Charles R Harris charlesr.harris@gmail....
Tue Jul 10 08:51:45 CDT 2012

On Tue, Jul 10, 2012 at 1:05 AM, Travis Oliphant <travis@continuum.io>wrote:

> On Jul 9, 2012, at 10:32 PM, Charles R Harris wrote:
> > Hi All,
> >
> > I've been adding type specific sorts for object and structured arrays.
> It seems that datetime64 and timedelta64 are also not supported. Is there
> any reason why those types should not be sorted as int64?
> >
> > Also, when sorting object arrays, what should be done with NULL pointers
> to objects? I'm tempted to treat them as nans and sort them to the end.
> OTOH, perhaps an error should be raised.
> My understanding is that people using missing data for object arrays will
> use the "None" object.  I don't think it's appropriate to ever have NULL
> pointers for OBJECT arrays except during initialization.
> For example, empty([10,5], dtype=object) produces an array of "None".
> What are you planning to do with None's?  You could treat them as nans, I
> would think.

It looks like empty returns arrays filled with None. The main reason I was
asking was that the compare function looks rather strange, checking for
NULL, but also potentially dereferencing NULL ;)

Thinking about things a bit more, it looks like qsort compatible versions
of heapsort and mergesort, say hsort and msort, would be useful for general

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20120710/00e78e2a/attachment.html 

More information about the NumPy-Discussion mailing list