I have non-small (10^6) numpy arrays which I then make some computations on. One of the functions simply returns 0 if the value is larger than some value X or return 1 otherwise. I understand this a simple bool check does the job:
x = np.arange(100)
x = np.array(x > X, dtype=int)
However, given that I'm creating a new array and making conversions it seems very wasteful. Any ideas on how to do in place? Something along the lines of x.round() (but that would return either 0 or 1).
Or are my concerns completely unfounded?
Thanks! P
PS: Yes, numpy is as requirement.