I want to find and replace multiple values in an 1D array / list with new ones.
In example for a list
a=[2, 3, 2, 5, 4, 4, 1, 2]
I woul
>>> arr = np.empty(a.max() + 1, dtype=val_new.dtype) >>> arr[val_old] = val_new >>> arr[a] array([3, 4, 3, 1, 5, 5, 2, 3])