[SciPy-user] Is numpy's argsort lying about its numpy.int32 types?

Rob Clewley rhc28@cornell....
Wed Apr 18 17:56:32 CDT 2007


Hi,

I'm having a problem comparing some types when using numpy's argsort.
I'm using numpy 1.0.2. I can reproduce it simply:

Python 2.4.4 (#71, Oct 18 2006, 08:34:43) [MSC v.1310 32 bit (Intel)]

<< snip >>

In [1]: from numpy import argsort, sort, int32, array

In [2]: x=array([1,3,2])

In [3]: aa=argsort(x)

In [4]: as=sort(x)

In [5]: type(aa[0])
Out[5]: <type 'numpy.int32'>

In [6]: type(as[0])
Out[6]: <type 'numpy.int32'>

In [7]: int32
Out[7]: <type 'numpy.int32'>

In [8]: type(as[0])==int32
Out[8]: True

In [9]: type(aa[0])==int32
Out[9]: False

Any of the three indices in aa give me the same problem. Can someone
explain if I should be doing this a different way, and if this is a
bug?!

Thanks,
Rob


More information about the SciPy-user mailing list