[SciPy-User] numpy.piecewise doesn't work with lists, only ndarrays
Juan Luis Cano Rodríguez
juanlu001@gmail....
Mon Oct 8 16:14:12 CDT 2012
I have noticed this behaviour of numpy.piecewise:
In [1]: import numpy as np
In [2]: q = [1, 2, 3, 4, 5, 6]
In [3]: np.piecewise(q, [q < 3, 3 <= q], [-1, 1])
Out[3]: array([ 1, -1, 0, 0, 0, 0])
In [4]: q = np.array(q)
In [5]: np.piecewise(q, [q < 3, 3 <= q], [-1, 1])
Out[5]: array([-1, -1, 1, 1, 1, 1])
Maybe the function should work the same both with lists and arrays? Should
I file a bug?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20121008/c8bdda23/attachment.html
More information about the SciPy-User
mailing list