How can I select multiple elements from a python array? I know that this is possible in numpy array but I cannot use numpy array in this case. I want to select certain elements of an array similar to masked array usage but i get following error in python
nonzero = numpyarray.nonzero()
pythonarray[nonzero] = numpyarray[nonzero]
*** TypeError: only integer arrays with one element can be converted to an index
numpyarray[nonzero] works fine but I cannot access pythonarray[nonzero]. Is there a way to do this in python array?