I have an odd dataframe which has two levels of heading. The first level makes up the column heading, and the second makes up the first row of the dataframe. Like this:
Fav-fruit Unnamed1 Unnamed2 Cost Purchsd? Unnamed3
0 Apples Bananas Pears Yes No
1 Apples 0.10 No
2 Pears 0.30 No
3 Apples 0.10 Yes
I want to drop a set of columns based on the second level header (i.e. on row 0). For example, to drop columns with Apples and Pears in row 0 to get this:
Fav-fruit Cost Purchsd? Unnamed3
0 Pears Yes No
1 0.10 No
2 Pears 0.30 No
3 0.10 Yes
The real dataframe has about 500 columns and I need to drop about 60 of them. I don't want to promote row 0 to become a new set of column headings, because I don't want to lose the current headings.
Is there an easy way to do this?