I would like to create a boolean index of an array that has true values whenever any integers in a given list appear in the array. Right now I do this by looping through the list of test integers and constructing a seperate boolean mask for each which I bitwise or
together like this:
boolean_mask = original_array == list_of_codes[0]
for code in list_of_codes[1::]:
boolean_mask = boolean_mask | (original_array == code)
Is there any shorthand numpy notation to do the equivalent without the loop?