Is this what you are looking for?
np.where(np.abs(a - x0) < np.abs(b - x0), a, b)
CLICK HERE to find out more related problems solutions.
Is this what you are looking for?
np.where(np.abs(a - x0) < np.abs(b - x0), a, b)
CLICK HERE to find out more related problems solutions.