For example, when i want to use numpy masked array as index, i got some trouble:
import numpy as np
a=np.array([0,1,2,3,4,5])
b=np.array([[0,1],[3,5]])
>>> a[b]
array([[0, 1],
[3, 5]]
well, THE PROBLEM is number 3 in b is not what i want. The result i want to geti is like
a[b]=array([[0, 1],
[5]])
so i used the numpy.ma:
b=np.ma.masked_equal(b,3)
>>> b
masked_array(data =
[[0 1]
[-- 5]],
mask =
[[False False]
[ True False]],
fill_value = 3)
>>> a[b]
array([[0, 1],
[3, 5]])
As we can see, the masked value still works as index, is there a way to fix it ?