[Numpy-discussion] searchsorted bug

lorenzo bolla lbolla@gmail....
Thu Jan 31 09:41:49 CST 2008


oops. it fails also on an SGI Altix with Suse Linux on it:
Linux pico 2.6.16.27-0.9-default #1 SMP Tue Feb 13 09:35:18 UTC 2007 ia64
ia64 ia64 GNU/Linux

--------------------------------------------
In [33]: A = numpy.array(['a','aa','b'])
In [34]: B = numpy.array(['d','e'])
In [35]: A.searchsorted(B)
Out[35]: array([3, 0])
In [36]: numpy.__version__
Out[36]: '1.0.5.dev4567'
--------------------------------------------

The problem seems to be in the different dtypes of A and B.
Using the same dtype '|S2' it works fine.

 --------------------------------------------
In [38]: A = numpy.array(['a','aa','b'])

In [39]: A.dtype
Out[39]:
dtype('|S2')

In [40]: B = numpy.array(['d','e'])
In [41]: A.searchsorted(B)
Out[41]: array([3, 0])
In [42]: B = numpy.array(['d','e'], dtype='|S2')
In [43]: A.searchsorted(B)
Out[43]: array([3, 3])
 --------------------------------------------

L.



On 1/31/08, Matthieu Brucher <matthieu.brucher@gmail.com> wrote:
>
> No problem for me (also a svn version) :
>
> Python 2.5.1 (r251:54863, Oct 30 2007, 13:54:11)
> [GCC 4.1.2 20070925 (Red Hat 4.1.2-33)] on linux2
>
> >>> import numpy
> >>> A = numpy.array(['a','aa','b'])
> >>> B = numpy.array(['d','e'])
> >>> A.searchsorted(B)
> array([3, 3])
>
> Matthieu
>
> 2008/1/31, lorenzo bolla <lbolla@gmail.com>:
> >
> > I use a dev version (1.0.5.dev4567).
> > L.
> >
> >
> > On 1/31/08, James Philbin <philbinj@gmail.com> wrote:
> > >
> > > Hmmm. Just downloaded and installed 1.0.4 and i'm still getting this
> > > error. Are you guys using the bleeding edge version or the official
> > > 1.0.4 tarball from the webpage?
> > >
> > > James
> > > _______________________________________________
> > > Numpy-discussion mailing list
> > > Numpy-discussion@scipy.org
> > > http://projects.scipy.org/mailman/listinfo/numpy-discussion
> > >
> >
> >
> >
> > --
> > Lorenzo Bolla
> > lbolla@gmail.com
> > http://lorenzobolla.emurse.com/
> >
> > _______________________________________________
> > Numpy-discussion mailing list
> > Numpy-discussion@scipy.org
> > http://projects.scipy.org/mailman/listinfo/numpy-discussion
> >
> >
>
>
> --
> French PhD student
> Website : http://matthieu-brucher.developpez.com/
> Blogs : http://matt.eifelle.com and http://blog.developpez.com/?blog=92
> LinkedIn : http://www.linkedin.com/in/matthieubrucher
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion@scipy.org
> http://projects.scipy.org/mailman/listinfo/numpy-discussion
>
>


-- 
Lorenzo Bolla
lbolla@gmail.com
http://lorenzobolla.emurse.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20080131/bb0d0653/attachment-0001.html 


More information about the Numpy-discussion mailing list