When I have a dataframe
df = DataFrame({'A': [5, 6, 3, 4], 'B': [1, 2, 3, 5]})
df
A B
0 5 1
1 6 2
2 3 3
3 4 5
I can use
df[df['A'].isin([3, 6])]
in order to select rows having the passed values.
Is there also a way to keep the order of the input list?
So that my output is not:
A B
1 6 2
2 3 3
but
A B
1 3 3
2 6 2