[Numpy-discussion] Is the select function broken in numpy?

Cory Davis corzneffect at gmail.com
Sun Mar 18 14:38:27 EDT 2007


no sorry, that is the wrong way around I changed it from
    return choose(S, tuple(choicelist))
to
    return choose(S.astype(int), tuple(choicelist))

On 3/18/07, Cory Davis <corzneffect at gmail.com> wrote:
> I have solved the problem by changing line 426 in function_base.py from
>     return choose(S.astype(int), tuple(choicelist))
> to
>     return choose(S, tuple(choicelist))
>
>
> On 3/18/07, Cory Davis <corzneffect at gmail.com> wrote:
> > I have a few day old svn update of numpy where the following code
> > produces an error, yet not in numpy-0.9.8
> >
> > from numpy import *
> >
> > print select([array([1]),array([0])],[array([2]),array([3])])
> >
> >   File "/tmp/tmpY-7FJN/lib64/python/numpy/lib/function_base.py", line
> > 426, in select
> >   File "/tmp/tmpY-7FJN/lib64/python/numpy/core/fromnumeric.py", line
> > 151, in choose
> > TypeError: array cannot be safely cast to required type
> > [
> > Any clues?
> >
>



More information about the NumPy-Discussion mailing list