Tag Archives: numpy

Thresholding numpy array, well sort of

Here is a test case >>> import numpy as np >>> a = np.array( [ 0.0, 1, 2, 0.2, 0.0, 0.0, 2, 3] ) I want to turn all non-zero elements of this array to 1. I can do it … Continue reading

Posted in Python, Uncategorized | Tagged , | Leave a comment