Skip to content

ExcelWriter should support engine="xlsxwriter" #462

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

Closed
Dr-Irv opened this issue Dec 8, 2022 · 0 comments · Fixed by #472
Closed

ExcelWriter should support engine="xlsxwriter" #462

Dr-Irv opened this issue Dec 8, 2022 · 0 comments · Fixed by #472
Assignees
Labels
good first issue IO Excel read_excel, to_excel

Comments

@Dr-Irv
Copy link
Collaborator

Dr-Irv commented Dec 8, 2022

Describe the bug
Need support engine="xlsxwriter" for ExcelWriter

To Reproduce

import pandas as pd

DF = pd.DataFrame({"a": [1, 2, 3], "b": [0.0, 0.0, 0.0]})

with pd.ExcelWriter("tmp.xlsx", mode="w", engine="xlsxwriter") as ew:
    DF.to_excel(ew, sheet_name="A")

pyright reports

ew.py
  c:\Code\pandas-stubs\ew.py:5:50 - error: Argument of type "Literal['xlsxwriter']" cannot be assigned to parameter "engine" of type "Literal['auto', 'openpyxl', 'pyxlsb', 'odf'] | None" in function "__init__"
    Type "Literal['xlsxwriter']" cannot be assigned to type "Literal['auto', 'openpyxl', 'pyxlsb', 'odf'] | None"
      Type cannot be assigned to type "None"
      "Literal['xlsxwriter']" cannot be assigned to type "Literal['auto']"
      "Literal['xlsxwriter']" cannot be assigned to type "Literal['openpyxl']"
      "Literal['xlsxwriter']" cannot be assigned to type "Literal['pyxlsb']"
      "Literal['xlsxwriter']" cannot be assigned to type "Literal['odf']" (reportGeneralTypeIssues)

Please complete the following information:

  • OS: Windows 10
  • python version: 3.9
  • version of type checker: pyright 1.1.283
  • version of installed pandas-stubs 1.5.2.221124

Additional context

Need to add "xlsxwriter" to:

engine: Literal["auto", "openpyxl", "pyxlsb", "odf"] | None = ...,

When creating a test, have to update pyproject.toml to install xlsxwriter for that test

@Dr-Irv Dr-Irv added good first issue IO Excel read_excel, to_excel labels Dec 8, 2022
bashtage added a commit to bashtage/pandas-stubs that referenced this issue Dec 15, 2022
@bashtage bashtage mentioned this issue Dec 15, 2022
2 tasks
Dr-Irv pushed a commit that referenced this issue Dec 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue IO Excel read_excel, to_excel
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants