I have a dataframe in this format:
a b x
1 1 31
1 2 1
1 3 42
1 4 423
1 5 42
1 6 3
1 7 44
1 8 65437
1 9 73
2 1 5656
2 2 7
2 3 5
2 4 5
2 5 34
a
and b
are indexes, x
is the value.
I want to get rows 1 9 73
and 2 5 34
, in other words, the last row of that level.
I've been messing with .loc
, .iloc
, and .xs
for an hour, but I can't get it to work. How do I do this?