I have array (or rather pandas frame) that has a column A, values in this columns are integers (let's assume that they belong to range 1..10). 
Now I would have to select rows in this array that have A values of {3, 6, 9} (in this example it is possible to just or == operations but in real life this set be a lot longer. 
Is there any funciton in either library (pandas or numpy) that allows me to do following fast: 
arr = pandas.DataFrame(...)
values = [3, 6, 9] 
valid_indexes = magic_function(arr.A, values)
or in numpy:
arr = np.ndarray(...)
values = [3, 6, 9] 
valid_indexes = magic_function(arr[13, :], values)
In other words I'm looking for element-wise in operator. 
docs are here
arr.loc[arr.A.isin([3,6,9])]
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With