a = np.array([101,105,90,102,90,10,50])
b = np.array([99,110,85,110,85,90,60])
expected result = np.array([2,5,5,8,5,20,10])
How can I find minimum absolute difference value between elements using just numpy operations; with modulus of 100 if two values are across 100.
>Solution :
One way to do this is to use np.minimum() with np.abs():
import numpy as np
a = np.array([101, 105, 90, 102, 90, 10, 50])
b = np.array([99, 110, 85, 110, 85, 90, 60])
print(np.minimum(np.abs(a - b), np.abs((a - b) % 100)))