I have the following array:
a = np.array([20, 10, 5, 15])
Given a new interval (for instance B = [10, 40]) I need to spread the values of the original array an the new interval, so the result would be:
b = np.array([40., 20, 10., 30])
A possible solution would be applying the following formula (in pseudocode) to each value:
new_value = min(B) + (current_value - min(a)) * (max(a)-min(a)) / (max(B)-min(B))
Any quicker approach ?