I have a dataframe, let's use this example:
df = pd.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
and I have a list of columns (by index) that I want to select, let's say:
list=['A','B','B','A']
What I want to obtain is [5,2,3,4], a series if possible. How can I do this?
I tried with masks, but I couldn't make it work.