Description
Code Sample, a copy-pastable example if possible
writer = pd.ExcelWriter(Path().resolve() / 'output' / 'out.xlsx')
for dftup in exportlist:
dftup[0].to_excel(writer, sheet_name=dftup[2])
Problem description
Note that a similar issue was covered in in #19242, but with a different data type.
The above code takes a list of tuples which contain the DataFrames (in position 0) and the desired sheet names (in position 2) I would like to write. These DataFrames have MultiIndex columns whose levels are type PeriodIndex. The first level is an index of yearly Periods (freq='Y') and the second level an index of Quarterly periods (freq='Q').
When I try to write the DataFrames to excel, I get the following error (I can post the whole trace if needed). Any ideas?
TypeError: Unsupported type <class 'pandas._libs.tslibs.period.Period'> in write()
Expected Output
Output of pd.show_versions()
INSTALLED VERSIONS
commit: None
python: 3.7.3.final.0
python-bits: 64
OS: Darwin
OS-release: 18.6.0
machine: x86_64
processor: i386
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: en_US.UTF-8
pandas: 0.24.2
pytest: 4.5.0
pip: 19.1.1
setuptools: 41.0.1
Cython: 0.29.8
numpy: 1.16.4
scipy: 1.2.1
pyarrow: None
xarray: None
IPython: 7.5.0
sphinx: 2.0.1
patsy: 0.5.1
dateutil: 2.8.0
pytz: 2019.1
blosc: None
bottleneck: 1.2.1
tables: 3.5.1
numexpr: 2.6.9
feather: None
matplotlib: 3.0.3
openpyxl: 2.6.2
xlrd: 1.2.0
xlwt: 1.3.0
xlsxwriter: 1.1.8
lxml.etree: 4.3.3
bs4: 4.7.1
html5lib: 1.0.1
sqlalchemy: 1.3.3
pymysql: None
psycopg2: 2.7.6.1 (dt dec pq3 ext lo64)
jinja2: 2.10.1
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None
gcsfs: None