Commit 9b84372
Justine Kosinski
BUG: Preserve NaN in MultiIndex column headers during Excel export
GH#62340: Use original column values (with NaN) instead of NBSP-filled
values when writing MultiIndex headers to Excel.
- Modify _format_header_mi() to use columns.get_level_values() to get
the original column values with NaN preserved
- Add test to verify MultiIndex structure and data integrity are
preserved during Excel round-trip
- Note: read_excel() limitation means NaN in headers become empty cells
in Excel and cannot be reconstructed on read, but data values are
correctly preserved1 parent 04cd920 commit 9b84372
2 files changed
+16
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
650 | 650 | | |
651 | 651 | | |
652 | 652 | | |
653 | | - | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
654 | 658 | | |
655 | 659 | | |
656 | 660 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1509 | 1509 | | |
1510 | 1510 | | |
1511 | 1511 | | |
| 1512 | + | |
| 1513 | + | |
| 1514 | + | |
1512 | 1515 | | |
1513 | 1516 | | |
1514 | 1517 | | |
| |||
1522 | 1525 | | |
1523 | 1526 | | |
1524 | 1527 | | |
1525 | | - | |
| 1528 | + | |
| 1529 | + | |
| 1530 | + | |
| 1531 | + | |
| 1532 | + | |
| 1533 | + | |
| 1534 | + | |
| 1535 | + | |
1526 | 1536 | | |
1527 | 1537 | | |
1528 | 1538 | | |
| |||
0 commit comments