Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions pandas/io/formats/excel.py
Original file line number Diff line number Diff line change
Expand Up @@ -826,6 +826,9 @@ def _format_hierarchical_rows(self) -> Iterable[ExcelCell]:
fill_value=levels._na_value,
)

if isinstance(values, PeriodIndex):
values = values.to_timestamp()

for i, span_val in spans.items():
mergestart, mergeend = None, None
if span_val > 1:
Expand All @@ -849,6 +852,10 @@ def _format_hierarchical_rows(self) -> Iterable[ExcelCell]:
# Format hierarchical rows with non-merged values.
for indexcolvals in zip(*self.df.index):
for idx, indexcolval in enumerate(indexcolvals):

if isinstance(indexcolval, Period):
indexcolval = indexcolval.to_timestamp()

yield CssExcelCell(
row=self.rowcounter + idx,
col=gcolidx,
Expand Down
Loading