I have a large spreadsheet file (.xlsx) that I'm processing using python pandas. I noticed there are duplicated headers and I want to rename specific columns without applying to the rest of them.
Jack | SPORT | UNI | SHOP | TOTAL | nan | Li | SPORT | UNI | SHOP | nan |
JULY | 1000 | 200 | 300 | 1500 | NaN |JULY| NaN | NaN | 1000 | nan |
The above table is the data that I extracted from an excel file. I want the output to be like this:
Month | Amount | UNI | SHOP | TOTAL | Li |Month | SPORT | TOWN | SHOP |
JULY | 1000 | 200 | 300 | 1500 | Nan|JULY | NaN | NaN | 1000 |
Questions:
1) Is there a way where I can select the specific column that has similar concept of iloc
but for columns? The goal is to rename specific column without interfering other duplicates.
2) How can I drop the last NaN
column?