[Numpy-discussion] Questions on np.piecewise

Joe solarjoe at posteo.org
Fri Sep 15 08:02:01 EDT 2017


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 not [2.1] ?

Kind regards,
Joe


More information about the NumPy-Discussion mailing list