Hi,
I have excel file with merged columns as below:
When I read using:
But I want:
I have excel file with merged columns as below:
Category Group Sub_valid Name Item Value Color Status Group1 VGT Power 0 VGT Power BHA Voltage 1 BHA VoltageGroup is merged for Name & Item column, Sub_valid is a merged column for Value, Color, Status.
When I read using:
import pandas as pd df = pd.read_excel('D:PythonCodes\mergedinput.xlsx',sheetname='Sheet1')The column above Item is "Unnamed0" & Color column & Status column are "Unnamed1", Unnamed2",
But I want:
Category Group Group Sub_valid Sub_valid Sub_valid Name Item Value Color Status Group1 VGT Power 0 VGT Power BHA Voltage 1 BHA VoltageI use below code but it needs to do multiple time:
df.rename(columns={'*Unnamed: 1':'nan'}, inplace=True)but I want to replace if header starts with: Unnamed"