I have a (8864,40) array A, containing both negative and positive values. I wanna divide the positive values of the array with the maximum value of A, and divide the negative values with the minimum of A. Is it possible to do this whilst also keeping the shape of the array A? Any help would be appreciated.
CodePudding user response:
This?
np.where(A > 0, A/A.max(), A/A.min())
CodePudding user response:
please see the snipped below
A[A > 0] /= np.max(A)
A[A < 0] /= np.min(A)