I have a problem on removing a specified column of a multiindex dataframe.
Suppose we have this df
:
df.columns
MultiIndex([('Status', 'Group A', 'PASS'),
('Status', 'Group A', 'Not PASS'),
('Status', 'Group A', 'Absent'),
('Status', 'Group B', 'PASS'),
('Status', 'Group B', 'Not PASS'),
('Status', 'Group B', 'Absent'),
('Status', 'Group B', nan),
('Status', 'Group C', 'PASS'),
('Status', 'Group C', 'Not PASS'),
('Status', 'Group C', 'Absent')],
names=[None, 'Group', 'Status'])
And we want to create a new dataframe based on df
and only want to extract ['Not Pass', 'Absent']
only.
Is there any way to slice/remove the unnecessary columns on the dataframe ?