fixed header=list (to create a MultiIndex) for read_excel #9637
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
closes #4679
This is a very simple fix to allow passing a list go the header argument of read_excel so that it creates a MultiIndex for columns. Given what is said in issue #4679, I am not really sure it is supposed to work, but with this fix, it works for my files. One thing discussed in issue #4679, which I did not do anything about (and thus probably still does not work) is if the header cells are merged, but my opinion is that this should be a separate issue, as it is already useful to be able to read files with the header duplicated (the files I receive are usually like this). If this PR is accepted (at least in spirit), the docstring for read_excel should probably be updated to reflect the "new" capability and the changelog updated, but I wanted to check first what you think.
As a side note, I am not entirely sure that _trim_excel_header is a good thing to do anyway, but that is another debate entirely.