Python Forum

Full Version: Removing some elements from array based on a condition
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi, I have this matlab code

A(A> numel(B)) = [ ];

where A and B are two arrays.

The code above, as I interpreted it, removes some of the elements in the A array based on the condition in the brackets.

I want to do the same in Python.

In an easier Matlab case like A(B) = [ ]

I simply would do

A= np.delete(A, B, axis = 0)
What about the above condition?

Would something like

A= np.delete(A, A >  B.size, axis = 0)
be correct?

Thank you.