Reputation: 1511
I have the following dataframe. When I tried to select rows with data[('PIC_next','last')] == 'Business'
, all rows return False
.
Is it the right way to filter multiindex column?
I have referred to this question. It seems that I am correct.
I created this dataframe by using groupby
.
Upvotes: 1
Views: 62
Reputation: 862511
I think you are correct.
Reason why not match should be in data, maybe traling whitespaces.
You can check it:
print (data[('PIC_next','last')].tolist())
And then remove it:
data[('PIC_next','last')].str.strip() == 'Business'
Upvotes: 1