Here is sample dataset:
|Count|
|-------------------------| |
|Name |ID_1 |Level |ID_2 | |
|-----|------|------|-----|-----|
|Kate |91978 |Junior|3 |13 |
|Lucy |47992 |Junior|3 |11 |
|John |37005 |Middle|2 |8 |
|Peter|42235 |Senior|1 |21 |
Let's say ['Name', 'ID_1', 'Level','ID_2'] are multi-index names
I want to drop all even multi-index names, meaning get rid of ['ID_1',ID_2'] So that end result looks like this:
|Count|
|-------------| |
|Name |Level | |
|------|------|-----|
|Kate |Junior|13 |
|Lucy |Junior|11 |
|John |Middle|8 |
|Peter |Senior|21 |
I found this method: df.index = df.index.droplevel(1)
But the thing is the real dataset is too big, and dropping each second column manually is not an option. How to drop all even columns at once?