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

Dataframe to Excel -- not working #396

Closed
firefly-cpp opened this issue Dec 27, 2022 · 2 comments · Fixed by #397
Closed

Dataframe to Excel -- not working #396

firefly-cpp opened this issue Dec 27, 2022 · 2 comments · Fixed by #397

Comments

@firefly-cpp
Copy link
Contributor

Let's call runner with the following settings: runner.run(export='xsl', verbose=True) .

Issue:
dataframe.to_excel(self.__generate_export_name("xls"))
Traceback (most recent call last):
File "compare-algorithms.py", line 41, in
runner.run(export='xsl', verbose=True)
File "/usr/lib/python3.11/site-packages/niapy/runner.py", line 147, in run
self._export_to_xls()
File "/usr/lib/python3.11/site-packages/niapy/runner.py", line 90, in _export_to_xls
dataframe.to_excel(self.__generate_export_name("xls"))
File "/usr/lib64/python3.11/site-packages/pandas/core/generic.py", line 2284, in to_excel
formatter.write(
File "/usr/lib64/python3.11/site-packages/pandas/io/formats/excel.py", line 834, in write
writer = ExcelWriter( # type: ignore[abstract]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib64/python3.11/site-packages/pandas/io/excel/_xlwt.py", line 39, in init
import xlwt
ModuleNotFoundError: No module named 'xlwt'

Summary:

xlwt library is archived. We have included openpyxl in dependencies, but it is not used correctly.

@firefly-cpp
Copy link
Contributor Author

One corresponding test may be added when this issue is fixed to identify this much before in the future.

@zStupan
Copy link
Contributor

zStupan commented Dec 28, 2022

The issue is caused by a typo here:

dataframe.to_excel(self.__generate_export_name("xslx"))

"xslx" should be "xlsx".

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

Successfully merging a pull request may close this issue.

2 participants