Re: [Numpy-discussion] Questions on np.piecewise

2017-09-15 Thread Joe
Your example doesn't run, but here is one that does: In [8]: x = np.array([50], dtype=float) In [9]: np.piecewise(x, [0 < x <= 90, 90 < x <= 180], [1.1, 2.1]) array([ 1.1]) The answer to your second question is that it is returning an array with the same dtype as its first argument. The answer

Re: [Numpy-discussion] Questions on np.piecewise

2017-09-15 Thread Eric Firing
On 2017/09/15 2:02 AM, Joe wrote: Hello, I have two questions and hope that you can help me. 1.) Is np.piecewise only defined for two conditions or should something like [0 < x <= 90, 90 < x <= 180, 180 < x <= 270] also work? 2.) Why does np.piecewise(np.array([50]), [0 < x <= 90, 90 < x <=

[Numpy-discussion] Questions on np.piecewise

2017-09-15 Thread Joe
Hello, I have two questions and hope that you can help me. 1.) Is np.piecewise only defined for two conditions or should something like [0 < x <= 90, 90 < x <= 180, 180 < x <= 270] also work? 2.) Why does np.piecewise(np.array([50]), [0 < x <= 90, 90 < x <= 180], [1.1, 2.1]) return [2] and