I\'m simply trying to use a masked array to filter out some nanentries.
nan
import numpy as np # x = [nan, -0.35, nan] x = np.ma.masked_equal(x, np.nan)
Here is another alternative without using mask:
import numpy as np #x = [nan, -0.35, nan] xmask=x[np.logical_not(np.isnan(x))] print(xmask)
Result:
array([-0.35])