def normalize(a): if a.max() == a.min(): return a return a - a.min()/(a.max()-a.min())