I want that numpy digitize
ignores some values in my array. To achieve this I replaced the unwanted values by NaN
and masked the NaN
values:
import numpy as np
A = np.ma.array(A, mask=np.isnan(A))
Nonetheless np.digitize
throws the masked values out as -1
. Is there an alternative way so that np.digitize
ignores the masked values (or NaN
)?