How to Convert Multi header Excel in Pandas to Simple TableConverting a Pandas GroupBy object to DataFrameHow to drop rows of Pandas DataFrame whose value in certain columns is NaN“Large data” work flows using pandasHow do I get the row count of a Pandas dataframe?How to iterate over rows in a DataFrame in Pandas?Get list from pandas DataFrame column headersHow to deal with SettingWithCopyWarning in Pandas?Convert list of dictionaries to a pandas DataFrameConvert Pandas column containing NaNs to dtype `int`How to pivot a dataframe
infared filters v nd
How do I deal with an unproductive colleague in a small company?
Is it possible to do 50 km distance without any previous training?
Roll the carpet
Paid for article while in US on F-1 visa?
What does it mean to describe someone as a butt steak?
Why is Minecraft giving an OpenGL error?
Intersection point of 2 lines defined by 2 points each
A case of the sniffles
I'm flying to France today and my passport expires in less than 2 months
Do I have a twin with permutated remainders?
Why are electrically insulating heatsinks so rare? Is it just cost?
meaning of に in 本当に?
How to format long polynomial?
Perform and show arithmetic with LuaLaTeX
How old can references or sources in a thesis be?
Approximately how much travel time was saved by the opening of the Suez Canal in 1869?
How to determine what difficulty is right for the game?
Is it unprofessional to ask if a job posting on GlassDoor is real?
Watching something be written to a file live with tail
If human space travel is limited by the G force vulnerability, is there a way to counter G forces?
Why is consensus so controversial in Britain?
What does the "remote control" for a QF-4 look like?
Theorems that impeded progress
How to Convert Multi header Excel in Pandas to Simple Table
Converting a Pandas GroupBy object to DataFrameHow to drop rows of Pandas DataFrame whose value in certain columns is NaN“Large data” work flows using pandasHow do I get the row count of a Pandas dataframe?How to iterate over rows in a DataFrame in Pandas?Get list from pandas DataFrame column headersHow to deal with SettingWithCopyWarning in Pandas?Convert list of dictionaries to a pandas DataFrameConvert Pandas column containing NaNs to dtype `int`How to pivot a dataframe
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I have a Excel data in below format
Time A Time B NAME A NAME B NAME C
Type A Type B Type C
Celcius Meters Kgs
2019-03-01 00:00:00 2019-02-28 23:59:55.560 8.0285 410.1051 410.5469
2019-03-01 00:00:10 2019-03-01 00:00:05.776 8.0439 410.1051 410.5938
2019-03-01 00:00:20 2019-03-01 00:00:14.995 8.0439 410.2134 410.6875
2019-03-01 00:00:30 2019-03-01 00:00:25.226 8.0439 410.0781 410.5469
2019-03-01 00:00:40 2019-03-01 00:00:35.444 8.0285 410.0239 410.5312
2019-03-01 00:00:50 2019-03-01 00:00:45.676 8.0439 410.1592 410.609
Which i want to convert as pandas dataframe as below
Time A, Time B, Name , Type , Unit , Value
I tried below code
import pandas as pd
xl = pd.ExcelFile('testx.xlsm')
df = xl.parse(xl.sheet_names[0])
df1 = df.set_index(['Time A', 'Time B'])
df1.columns = [df1.columns,df1.iloc[0], df1.iloc[1]]
df1 = df1.iloc[2:].reset_index(drop=False)
df1.unstack(level=-1)
I tried below code and getting something better but memory intensive.
xl = pd.ExcelFile('test2.xlsm', )
df = xl.parse(xl.sheet_names[0],index_col=[0,1], header=[0,1,2] )
df1 = df.stack().stack().stack()
expected result is like this
Time A Time B name Type Unit Value
2019-03-01 00:00:00 2019-02-28 23:59:55.560 NAME A Type A Celcius 8.0285
NAME B Type B Meters 410.1051
NAME C Type C Kgs 410.5469
python pandas dataframe
add a comment |
I have a Excel data in below format
Time A Time B NAME A NAME B NAME C
Type A Type B Type C
Celcius Meters Kgs
2019-03-01 00:00:00 2019-02-28 23:59:55.560 8.0285 410.1051 410.5469
2019-03-01 00:00:10 2019-03-01 00:00:05.776 8.0439 410.1051 410.5938
2019-03-01 00:00:20 2019-03-01 00:00:14.995 8.0439 410.2134 410.6875
2019-03-01 00:00:30 2019-03-01 00:00:25.226 8.0439 410.0781 410.5469
2019-03-01 00:00:40 2019-03-01 00:00:35.444 8.0285 410.0239 410.5312
2019-03-01 00:00:50 2019-03-01 00:00:45.676 8.0439 410.1592 410.609
Which i want to convert as pandas dataframe as below
Time A, Time B, Name , Type , Unit , Value
I tried below code
import pandas as pd
xl = pd.ExcelFile('testx.xlsm')
df = xl.parse(xl.sheet_names[0])
df1 = df.set_index(['Time A', 'Time B'])
df1.columns = [df1.columns,df1.iloc[0], df1.iloc[1]]
df1 = df1.iloc[2:].reset_index(drop=False)
df1.unstack(level=-1)
I tried below code and getting something better but memory intensive.
xl = pd.ExcelFile('test2.xlsm', )
df = xl.parse(xl.sheet_names[0],index_col=[0,1], header=[0,1,2] )
df1 = df.stack().stack().stack()
expected result is like this
Time A Time B name Type Unit Value
2019-03-01 00:00:00 2019-02-28 23:59:55.560 NAME A Type A Celcius 8.0285
NAME B Type B Meters 410.1051
NAME C Type C Kgs 410.5469
python pandas dataframe
Are you trying to get a dataframe where the headers for columns 3,4 and 5 have 3 lines each?
– Jack Fleeting
Mar 22 at 1:24
Yes that's correct.
– jaiswalm
Mar 22 at 15:19
add a comment |
I have a Excel data in below format
Time A Time B NAME A NAME B NAME C
Type A Type B Type C
Celcius Meters Kgs
2019-03-01 00:00:00 2019-02-28 23:59:55.560 8.0285 410.1051 410.5469
2019-03-01 00:00:10 2019-03-01 00:00:05.776 8.0439 410.1051 410.5938
2019-03-01 00:00:20 2019-03-01 00:00:14.995 8.0439 410.2134 410.6875
2019-03-01 00:00:30 2019-03-01 00:00:25.226 8.0439 410.0781 410.5469
2019-03-01 00:00:40 2019-03-01 00:00:35.444 8.0285 410.0239 410.5312
2019-03-01 00:00:50 2019-03-01 00:00:45.676 8.0439 410.1592 410.609
Which i want to convert as pandas dataframe as below
Time A, Time B, Name , Type , Unit , Value
I tried below code
import pandas as pd
xl = pd.ExcelFile('testx.xlsm')
df = xl.parse(xl.sheet_names[0])
df1 = df.set_index(['Time A', 'Time B'])
df1.columns = [df1.columns,df1.iloc[0], df1.iloc[1]]
df1 = df1.iloc[2:].reset_index(drop=False)
df1.unstack(level=-1)
I tried below code and getting something better but memory intensive.
xl = pd.ExcelFile('test2.xlsm', )
df = xl.parse(xl.sheet_names[0],index_col=[0,1], header=[0,1,2] )
df1 = df.stack().stack().stack()
expected result is like this
Time A Time B name Type Unit Value
2019-03-01 00:00:00 2019-02-28 23:59:55.560 NAME A Type A Celcius 8.0285
NAME B Type B Meters 410.1051
NAME C Type C Kgs 410.5469
python pandas dataframe
I have a Excel data in below format
Time A Time B NAME A NAME B NAME C
Type A Type B Type C
Celcius Meters Kgs
2019-03-01 00:00:00 2019-02-28 23:59:55.560 8.0285 410.1051 410.5469
2019-03-01 00:00:10 2019-03-01 00:00:05.776 8.0439 410.1051 410.5938
2019-03-01 00:00:20 2019-03-01 00:00:14.995 8.0439 410.2134 410.6875
2019-03-01 00:00:30 2019-03-01 00:00:25.226 8.0439 410.0781 410.5469
2019-03-01 00:00:40 2019-03-01 00:00:35.444 8.0285 410.0239 410.5312
2019-03-01 00:00:50 2019-03-01 00:00:45.676 8.0439 410.1592 410.609
Which i want to convert as pandas dataframe as below
Time A, Time B, Name , Type , Unit , Value
I tried below code
import pandas as pd
xl = pd.ExcelFile('testx.xlsm')
df = xl.parse(xl.sheet_names[0])
df1 = df.set_index(['Time A', 'Time B'])
df1.columns = [df1.columns,df1.iloc[0], df1.iloc[1]]
df1 = df1.iloc[2:].reset_index(drop=False)
df1.unstack(level=-1)
I tried below code and getting something better but memory intensive.
xl = pd.ExcelFile('test2.xlsm', )
df = xl.parse(xl.sheet_names[0],index_col=[0,1], header=[0,1,2] )
df1 = df.stack().stack().stack()
expected result is like this
Time A Time B name Type Unit Value
2019-03-01 00:00:00 2019-02-28 23:59:55.560 NAME A Type A Celcius 8.0285
NAME B Type B Meters 410.1051
NAME C Type C Kgs 410.5469
python pandas dataframe
python pandas dataframe
edited Mar 26 at 16:38
jaiswalm
asked Mar 21 at 22:51
jaiswalmjaiswalm
164
164
Are you trying to get a dataframe where the headers for columns 3,4 and 5 have 3 lines each?
– Jack Fleeting
Mar 22 at 1:24
Yes that's correct.
– jaiswalm
Mar 22 at 15:19
add a comment |
Are you trying to get a dataframe where the headers for columns 3,4 and 5 have 3 lines each?
– Jack Fleeting
Mar 22 at 1:24
Yes that's correct.
– jaiswalm
Mar 22 at 15:19
Are you trying to get a dataframe where the headers for columns 3,4 and 5 have 3 lines each?
– Jack Fleeting
Mar 22 at 1:24
Are you trying to get a dataframe where the headers for columns 3,4 and 5 have 3 lines each?
– Jack Fleeting
Mar 22 at 1:24
Yes that's correct.
– jaiswalm
Mar 22 at 15:19
Yes that's correct.
– jaiswalm
Mar 22 at 15:19
add a comment |
2 Answers
2
active
oldest
votes
I think this should get you there:
import pandas as pd
arrays = [['Time A', 'Time B', 'NAME A ', 'NAME B','NAME C'], ['', '', 'Type A','Type B','Type C'], ['', '', 'Celcius','Meters','Kgs']]
df.columns = pd.MultiIndex.from_arrays(arrays)
df
Asssuming your current dataframe already has the Excel data (without the headers), your output should be:
Time A Time B NAME A NAME B NAME C
Type A Type B Type C
Celcius Meters Kgs
0 2019-03-0100:00:00 2019-02-2823:59:55.560 8.0285 410.1051 410.5469
format you are showing is Excel Source format. I wanted data in below format convert as pandas dataframe as below. That means fro each date time there will be three values fro three headers. Time A, Time B, Name , Type , Unit , Value
– jaiswalm
Mar 22 at 20:40
1
Sorry, I don't understand what you're looking for. Maybe you should edit your question to include a sample output.
– Jack Fleeting
Mar 22 at 20:46
Added Example in the original post.
– jaiswalm
Mar 22 at 21:10
add a comment |
Another efficient solution found is
# Generate Data Frame
def load_file_in_df(fileName, filePath):
logging.info("Loading file : "+fileName)
if os.path.isfile(filePath +fileName):
obj_xl = pd.ExcelFile(filePath + fileName )
df_excel = obj_xl.parse(obj_xl.sheet_names[0],index_col=[0,1], header=[0,1,2] )
else:
print("File does not exists: " +filePath + fileName)
return df_excel
# Parse Dataframe
def parse_10sec_df(df_excel):
rows, cols = df_excel.shape
l_excel = []
for row in df_excel.itertuples():
for i in range(cols):
l = []
l.append (row[0][0])
l.append (row[0][1] )
l.append (df_excel.columns.values[i][0])
l.append (df_excel.columns.values[i][1])
l.append (df_excel.columns.values[i][2])
l.append (row[i+1] )
l_excel.append(tuple(l))
#print row[i]
return l_excel
Above will produce a tuple with below data.
Time A Time B name Type Unit Value
2019-03-01 00:00:00 2019-02-28 23:59:55.560 NAME A Type A Celcius 8.0285
NAME B Type B Meters 410.1051
NAME C Type C Kgs 410.5469
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55290407%2fhow-to-convert-multi-header-excel-in-pandas-to-simple-table%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
I think this should get you there:
import pandas as pd
arrays = [['Time A', 'Time B', 'NAME A ', 'NAME B','NAME C'], ['', '', 'Type A','Type B','Type C'], ['', '', 'Celcius','Meters','Kgs']]
df.columns = pd.MultiIndex.from_arrays(arrays)
df
Asssuming your current dataframe already has the Excel data (without the headers), your output should be:
Time A Time B NAME A NAME B NAME C
Type A Type B Type C
Celcius Meters Kgs
0 2019-03-0100:00:00 2019-02-2823:59:55.560 8.0285 410.1051 410.5469
format you are showing is Excel Source format. I wanted data in below format convert as pandas dataframe as below. That means fro each date time there will be three values fro three headers. Time A, Time B, Name , Type , Unit , Value
– jaiswalm
Mar 22 at 20:40
1
Sorry, I don't understand what you're looking for. Maybe you should edit your question to include a sample output.
– Jack Fleeting
Mar 22 at 20:46
Added Example in the original post.
– jaiswalm
Mar 22 at 21:10
add a comment |
I think this should get you there:
import pandas as pd
arrays = [['Time A', 'Time B', 'NAME A ', 'NAME B','NAME C'], ['', '', 'Type A','Type B','Type C'], ['', '', 'Celcius','Meters','Kgs']]
df.columns = pd.MultiIndex.from_arrays(arrays)
df
Asssuming your current dataframe already has the Excel data (without the headers), your output should be:
Time A Time B NAME A NAME B NAME C
Type A Type B Type C
Celcius Meters Kgs
0 2019-03-0100:00:00 2019-02-2823:59:55.560 8.0285 410.1051 410.5469
format you are showing is Excel Source format. I wanted data in below format convert as pandas dataframe as below. That means fro each date time there will be three values fro three headers. Time A, Time B, Name , Type , Unit , Value
– jaiswalm
Mar 22 at 20:40
1
Sorry, I don't understand what you're looking for. Maybe you should edit your question to include a sample output.
– Jack Fleeting
Mar 22 at 20:46
Added Example in the original post.
– jaiswalm
Mar 22 at 21:10
add a comment |
I think this should get you there:
import pandas as pd
arrays = [['Time A', 'Time B', 'NAME A ', 'NAME B','NAME C'], ['', '', 'Type A','Type B','Type C'], ['', '', 'Celcius','Meters','Kgs']]
df.columns = pd.MultiIndex.from_arrays(arrays)
df
Asssuming your current dataframe already has the Excel data (without the headers), your output should be:
Time A Time B NAME A NAME B NAME C
Type A Type B Type C
Celcius Meters Kgs
0 2019-03-0100:00:00 2019-02-2823:59:55.560 8.0285 410.1051 410.5469
I think this should get you there:
import pandas as pd
arrays = [['Time A', 'Time B', 'NAME A ', 'NAME B','NAME C'], ['', '', 'Type A','Type B','Type C'], ['', '', 'Celcius','Meters','Kgs']]
df.columns = pd.MultiIndex.from_arrays(arrays)
df
Asssuming your current dataframe already has the Excel data (without the headers), your output should be:
Time A Time B NAME A NAME B NAME C
Type A Type B Type C
Celcius Meters Kgs
0 2019-03-0100:00:00 2019-02-2823:59:55.560 8.0285 410.1051 410.5469
answered Mar 22 at 17:57
Jack FleetingJack Fleeting
636314
636314
format you are showing is Excel Source format. I wanted data in below format convert as pandas dataframe as below. That means fro each date time there will be three values fro three headers. Time A, Time B, Name , Type , Unit , Value
– jaiswalm
Mar 22 at 20:40
1
Sorry, I don't understand what you're looking for. Maybe you should edit your question to include a sample output.
– Jack Fleeting
Mar 22 at 20:46
Added Example in the original post.
– jaiswalm
Mar 22 at 21:10
add a comment |
format you are showing is Excel Source format. I wanted data in below format convert as pandas dataframe as below. That means fro each date time there will be three values fro three headers. Time A, Time B, Name , Type , Unit , Value
– jaiswalm
Mar 22 at 20:40
1
Sorry, I don't understand what you're looking for. Maybe you should edit your question to include a sample output.
– Jack Fleeting
Mar 22 at 20:46
Added Example in the original post.
– jaiswalm
Mar 22 at 21:10
format you are showing is Excel Source format. I wanted data in below format convert as pandas dataframe as below. That means fro each date time there will be three values fro three headers. Time A, Time B, Name , Type , Unit , Value
– jaiswalm
Mar 22 at 20:40
format you are showing is Excel Source format. I wanted data in below format convert as pandas dataframe as below. That means fro each date time there will be three values fro three headers. Time A, Time B, Name , Type , Unit , Value
– jaiswalm
Mar 22 at 20:40
1
1
Sorry, I don't understand what you're looking for. Maybe you should edit your question to include a sample output.
– Jack Fleeting
Mar 22 at 20:46
Sorry, I don't understand what you're looking for. Maybe you should edit your question to include a sample output.
– Jack Fleeting
Mar 22 at 20:46
Added Example in the original post.
– jaiswalm
Mar 22 at 21:10
Added Example in the original post.
– jaiswalm
Mar 22 at 21:10
add a comment |
Another efficient solution found is
# Generate Data Frame
def load_file_in_df(fileName, filePath):
logging.info("Loading file : "+fileName)
if os.path.isfile(filePath +fileName):
obj_xl = pd.ExcelFile(filePath + fileName )
df_excel = obj_xl.parse(obj_xl.sheet_names[0],index_col=[0,1], header=[0,1,2] )
else:
print("File does not exists: " +filePath + fileName)
return df_excel
# Parse Dataframe
def parse_10sec_df(df_excel):
rows, cols = df_excel.shape
l_excel = []
for row in df_excel.itertuples():
for i in range(cols):
l = []
l.append (row[0][0])
l.append (row[0][1] )
l.append (df_excel.columns.values[i][0])
l.append (df_excel.columns.values[i][1])
l.append (df_excel.columns.values[i][2])
l.append (row[i+1] )
l_excel.append(tuple(l))
#print row[i]
return l_excel
Above will produce a tuple with below data.
Time A Time B name Type Unit Value
2019-03-01 00:00:00 2019-02-28 23:59:55.560 NAME A Type A Celcius 8.0285
NAME B Type B Meters 410.1051
NAME C Type C Kgs 410.5469
add a comment |
Another efficient solution found is
# Generate Data Frame
def load_file_in_df(fileName, filePath):
logging.info("Loading file : "+fileName)
if os.path.isfile(filePath +fileName):
obj_xl = pd.ExcelFile(filePath + fileName )
df_excel = obj_xl.parse(obj_xl.sheet_names[0],index_col=[0,1], header=[0,1,2] )
else:
print("File does not exists: " +filePath + fileName)
return df_excel
# Parse Dataframe
def parse_10sec_df(df_excel):
rows, cols = df_excel.shape
l_excel = []
for row in df_excel.itertuples():
for i in range(cols):
l = []
l.append (row[0][0])
l.append (row[0][1] )
l.append (df_excel.columns.values[i][0])
l.append (df_excel.columns.values[i][1])
l.append (df_excel.columns.values[i][2])
l.append (row[i+1] )
l_excel.append(tuple(l))
#print row[i]
return l_excel
Above will produce a tuple with below data.
Time A Time B name Type Unit Value
2019-03-01 00:00:00 2019-02-28 23:59:55.560 NAME A Type A Celcius 8.0285
NAME B Type B Meters 410.1051
NAME C Type C Kgs 410.5469
add a comment |
Another efficient solution found is
# Generate Data Frame
def load_file_in_df(fileName, filePath):
logging.info("Loading file : "+fileName)
if os.path.isfile(filePath +fileName):
obj_xl = pd.ExcelFile(filePath + fileName )
df_excel = obj_xl.parse(obj_xl.sheet_names[0],index_col=[0,1], header=[0,1,2] )
else:
print("File does not exists: " +filePath + fileName)
return df_excel
# Parse Dataframe
def parse_10sec_df(df_excel):
rows, cols = df_excel.shape
l_excel = []
for row in df_excel.itertuples():
for i in range(cols):
l = []
l.append (row[0][0])
l.append (row[0][1] )
l.append (df_excel.columns.values[i][0])
l.append (df_excel.columns.values[i][1])
l.append (df_excel.columns.values[i][2])
l.append (row[i+1] )
l_excel.append(tuple(l))
#print row[i]
return l_excel
Above will produce a tuple with below data.
Time A Time B name Type Unit Value
2019-03-01 00:00:00 2019-02-28 23:59:55.560 NAME A Type A Celcius 8.0285
NAME B Type B Meters 410.1051
NAME C Type C Kgs 410.5469
Another efficient solution found is
# Generate Data Frame
def load_file_in_df(fileName, filePath):
logging.info("Loading file : "+fileName)
if os.path.isfile(filePath +fileName):
obj_xl = pd.ExcelFile(filePath + fileName )
df_excel = obj_xl.parse(obj_xl.sheet_names[0],index_col=[0,1], header=[0,1,2] )
else:
print("File does not exists: " +filePath + fileName)
return df_excel
# Parse Dataframe
def parse_10sec_df(df_excel):
rows, cols = df_excel.shape
l_excel = []
for row in df_excel.itertuples():
for i in range(cols):
l = []
l.append (row[0][0])
l.append (row[0][1] )
l.append (df_excel.columns.values[i][0])
l.append (df_excel.columns.values[i][1])
l.append (df_excel.columns.values[i][2])
l.append (row[i+1] )
l_excel.append(tuple(l))
#print row[i]
return l_excel
Above will produce a tuple with below data.
Time A Time B name Type Unit Value
2019-03-01 00:00:00 2019-02-28 23:59:55.560 NAME A Type A Celcius 8.0285
NAME B Type B Meters 410.1051
NAME C Type C Kgs 410.5469
answered Mar 26 at 15:45
jaiswalmjaiswalm
164
164
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55290407%2fhow-to-convert-multi-header-excel-in-pandas-to-simple-table%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Are you trying to get a dataframe where the headers for columns 3,4 and 5 have 3 lines each?
– Jack Fleeting
Mar 22 at 1:24
Yes that's correct.
– jaiswalm
Mar 22 at 15:19