Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pandas question
#1
Hi,
I now have been handed a bunch of legacy excel files.
The author had the good idea to put two header rows, but both have column names i want.
So I do:
xls = panda.read_excel(exel,header = 1,sheet_name = 'Sheet1')
But: some headers take up the 2 rows (0 and 1), others have something in row zero, and something in row 1 , like this:
..... | Family Name and firstnames..... |
NR | Name | Firstname | second name | etc...

When I specify header = 0, I can't get the second row names , when header = 1 the "NR" field is not recognised.
This happens 4 times. in the header rows. All excels are like this.
Remedy ?
Or skip the headers?
thx,
Paul
It is more important to do the right thing, than to do the thing right.(P.Drucker)
Better is the enemy of good. (Montesquieu) = French version for 'kiss'.
Reply


Messages In This Thread
Pandas question - by DPaul - Mar-27-2023, 03:32 PM
RE: Pandas question - by farshid - Apr-20-2023, 04:30 PM
RE: Pandas question - by deanhystad - Apr-20-2023, 08:42 PM
RE: Pandas question - by DPaul - Apr-22-2023, 05:51 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How is pandas modifying all rows in an assignment - python-newbie question markm74 1 796 Nov-28-2023, 10:36 PM
Last Post: deanhystad
  Question on pandas.dataframe merging two colums shomikc 4 927 Jun-29-2023, 11:30 AM
Last Post: snippsat

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020