I need to translate the matlab code
indexSelect0 = a.index1==0 & a.index2==wRange;
into a fast python style. My try is:
idx1=np.array(np.where(a['index2'][:,0]==wIndex2))
idx=np.array(np.where(a['index1'][:,0]==wIndex1))
indexSelect0 = ma.masked_array(idx,mask=[not (i in idx1[0,:]) for i in idx[0,:]])
but it takes a while as the array is pretty long (more than 5M of samples).
The problem can be stated as : I have an array of data that is composed of different observations. I have 2 indices that allow me to know where is what. But I am not able to find the right way to combine two options to filter the data.
Hope it is clear.
Thanks for your help
a? Is it dataframe? Could you provide sample data?