Skip to content

Internal read_excel() typing for index_col is incorrect #55843

Closed
@Dr-Irv

Description

@Dr-Irv

Inside the pandas source, the index_col argument for read_excel() is typed as:

    index_col: int | Sequence[int] | None = ...,

But the docs say that a string is accepted, as shown in the example below.

from pandas import read_excel
print(read_excel("Book1.xlsx"))
print(read_excel("Book1.xlsx", index_col="bar"))

Output:

   foo  bar
0    1    2
1    3    4
     foo
bar     
2      1
4      3

Book1.xlsx

Originally posted by @clo-vis in pandas-dev/pandas-stubs#809 (comment)

Metadata

Metadata

Assignees

Labels

IO Excelread_excel, to_excelTypingtype annotations, mypy/pyright type checkinggood first issue

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions