I'm new to pandas. My df looks like this:
A A A B B B
a NaN NaN 2 NaN NaN 5
b NaN 1 NaN 9 NaN NaN
c 3 NaN NaN 7 NaN
How can I get
A B
a 2 5
b 1 9
c 3 7
It looks like merge, join are for more than one dataframe. I have also tried
df.groupby(by=[A,B], axis=1)
but got
ValueError: Grouper and axis must be same length