Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust for pyam 1.7.0 #77

Closed
khaeru opened this issue Jan 9, 2023 · 1 comment
Closed

Adjust for pyam 1.7.0 #77

khaeru opened this issue Jan 9, 2023 · 1 comment
Assignees

Comments

@khaeru
Copy link
Owner

khaeru commented Jan 9, 2023

pyam 1.7.0 was released on 2022-12-19. Per IAMconsortium/pyam#708, specifically here, keyword arguments to IamDataFrame are directly fed to pandas.DataFrame.to_excel(). (See also the blame for this method. It appears at some point pyam forced engine="openpyxl" and accepted but ignored the keyword arguments.)

This causes failures in genno.compat.pyam.write_report(), e.g. here:

 genno/compat/pyam/computations.py:109: in write_report
    obj.to_excel(path, merge_cells=False)
/opt/hostedtoolcache/Python/3.10.9/x64/lib/python3.10/site-packages/pyam/core.py:2382: in to_excel
    excel_writer = pd.ExcelWriter(excel_writer, **kwargs)

(snip)

>       self._book = Workbook(self._handles.handle, **engine_kwargs)
E       TypeError: Workbook.__init__() got an unexpected keyword argument 'merge_cells'

/opt/hostedtoolcache/Python/3.10.9/x64/lib/python3.10/site-packages/pandas/io/excel/_xlsxwriter.py:216: TypeError

This is because pyam is now allowing pandas to select xlsxwriter as the engine, and the merge_cells keyword argument is not understood by this engine.

The fix is likely to (a) remove and (b) specify a minimum version of pyam to avoid the need for genno to handle the shift(s) in behaviour.

@khaeru khaeru self-assigned this Jan 9, 2023
@khaeru
Copy link
Owner Author

khaeru commented Jan 31, 2023

Closed by #78.

@khaeru khaeru closed this as completed Jan 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant