Flexible and powerful data analysis / manipulation library for Python, providing labeled data structures similar to R data.frame objects, statistical functions, and much more
When exporting a Series/DataFrame to excel when the index contains a PeriodIndex the format of the output depends on the index being an Index or a MultiIndex.
When the PeriodIndex is in an Index, the output format in Excel is a date.
When the PeriodIndex is a level from a MultiIndex, the output format is a string.
Expected Behavior
The expected behaviour is that the format of the period would not be dependent on it being in an Index or in a MultiIndex. Being either a string or a date in excel is both acceptable as long as it is consistent in both outputs.
Pandas version checks
[X] I have checked that this issue has not already been reported.
[X] I have confirmed this bug exists on the latest version of pandas.
[X] I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
Issue Description
When exporting a Series/DataFrame to excel when the index contains a PeriodIndex the format of the output depends on the index being an Index or a MultiIndex.
When the PeriodIndex is in an Index, the output format in Excel is a date. When the PeriodIndex is a level from a MultiIndex, the output format is a string.
Expected Behavior
The expected behaviour is that the format of the period would not be dependent on it being in an Index or in a MultiIndex. Being either a string or a date in excel is both acceptable as long as it is consistent in both outputs.
Installed Versions