Improve Reading and Writing of Multi-Index Columns · Issue #3571 · pandas-dev/pandas (original) (raw)
Navigation Menu
- Explore
- Pricing
Provide feedback
Saved searches
Use saved searches to filter your results more quickly
Appearance settings
Description
link to #1651 (to_csv) and #3141 (read_csv)
Currently (0.11) when the read_csv and to_csv methods handle multi-index row labels fine, but don't do as well with multi-index column labels. For the column index the to_csv method writes them out as a tuple into the 1st row of the CSV file. This reads back in as a tuple. It would be better if it actually wrote out each element of the multi-index as a row of the CSV file and you could then specify a range of rows for the header on read_csv to reconstruct the multi-index column header. I'm thinking of something like "header=[0,1]" to read in the first two rows of the CSV file as a 2 element multi-index column header. What's not clear to me is where you read/write the names of the indices.