I have an array. The valid values are not zero (either positive or negetive). I want to find the minimum and maximum within the array which should not take zeros into accoun
How about:
import numpy as np minval = np.min(a[np.nonzero(a)]) maxval = np.max(a[np.nonzero(a)])
where a is your array.
a