I have a numpy array which I need to filter and perform a sum on. Similar to my previous question, although this one needs to be filtered by two conditions.
Need to return the sum of column 7
where column 0 == ptype
AND column 8 == radius
.
np.sum(data[data[:,0] == ptype and data[data[:,8] <= radius],7])
I get the following error:
The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
Any ideas?