Skip to content

Argument BytesIO is not assignable to parameter excel_writer for Pandas #1626

@wyfok

Description

@wyfok

Describe the Bug

When df.to_excel to a BytesIO , the VS extension flags below error

Argument `BytesIO` is not assignable to parameter `excel_writer` with type `ExcelWriter[Unknown] | PathLike[str] | WriteExcelBuffer | str` in function `pandas.core.generic.NDFrame.to_excel`  

code:

from io import BytesIO
import pandas as pd 
import openpyxl

bytesio = BytesIO()
df = pd.DataFrame(columns = pd.Index(["A","B","C"]))
df.to_excel(bytesio, engine="openpyxl", index=False) 

Sandbox Link

No response

(Only applicable for extension issues) IDE Information

No response

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions