I need to compute x in the following way (legacy code):
x
x = numpy.where(b == 0, a, 1/b)
I suppose it worked in python-2.x (as
I solved it using this:
x = (1/(np.where(b == 0, np.nan, b))).fillna(a)