python's and looks at the boolean value on either side of the condition. Because of design decisions in numpy, arrays with more than 1 value don't have a boolean value (it raises ValueError as you've seen. The solution is to use the np.logical_and function.
mask = np.logical_and(data[:, 0] == ptype, data[:, 8] <= radius)np.sum(data[mask, 7])Note that & will work as well in this case as you have arrays of booleans -- However, I don't like to use that one in general as typically (and with numpy as well), & means bitwise and rather than logical and.