df = pd.DataFrame([10,20,30,40], index=[[1,1,2,2],[1,4,3,2]])
df.index.names=['a','b']
I would like to keep the rows in which index a equals index b:
0
1 1 10
2 2 40
I thought maybe a lambda could work in this case
df.index[lambda x: x[0]==x[1]]
but it doesn't. How could I get the result above?