Skip to content
Prev Previous commit
Next Next commit
Remove typevar
  • Loading branch information
phofl committed Dec 29, 2021
commit ceb17c68d1a3460ea6c1ff9b4acd4fb52f2b9c66
1 change: 0 additions & 1 deletion pandas/_typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@
DatetimeLikeScalar = Union["Period", "Timestamp", "Timedelta"]
PandasScalar = Union["Period", "Timestamp", "Timedelta", "Interval"]
Scalar = Union[PythonScalar, PandasScalar]
IntStrT = TypeVar("IntStrT", int, str)


# timestamp and timedelta convertible types
Expand Down
42 changes: 37 additions & 5 deletions pandas/io/excel/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
from pandas._typing import (
DtypeArg,
FilePath,
IntStrT,
ReadBuffer,
StorageOptions,
WriteExcelBuffer,
Expand Down Expand Up @@ -387,7 +386,7 @@ def read_excel(
@overload
def read_excel(
io,
sheet_name: list[IntStrT] | None,
sheet_name: list[int],
header: int | Sequence[int] | None = ...,
names=...,
index_col: int | Sequence[int] | None = ...,
Expand All @@ -413,15 +412,48 @@ def read_excel(
convert_float: bool | None = ...,
mangle_dupe_cols: bool = ...,
storage_options: StorageOptions = ...,
) -> dict[IntStrT, DataFrame]:
) -> dict[int, DataFrame]:
...


@overload
def read_excel(
io,
sheet_name: list[str] | None,
header: int | Sequence[int] | None = ...,
names=...,
index_col: int | Sequence[int] | None = ...,
usecols=...,
squeeze: bool | None = ...,
dtype: DtypeArg | None = ...,
engine: Literal["xlrd", "openpyxl", "odf", "pyxlsb"] | None = ...,
converters=...,
true_values: Iterable[Hashable] | None = ...,
false_values: Iterable[Hashable] | None = ...,
skiprows: Sequence[int] | int | Callable[[int], object] | None = ...,
nrows: int | None = ...,
na_values=...,
keep_default_na: bool = ...,
na_filter: bool = ...,
verbose: bool = ...,
parse_dates=...,
date_parser=...,
thousands: str | None = ...,
decimal: str = ...,
comment: str | None = ...,
skipfooter: int = ...,
convert_float: bool | None = ...,
mangle_dupe_cols: bool = ...,
storage_options: StorageOptions = ...,
) -> dict[str, DataFrame]:
...


@deprecate_nonkeyword_arguments(allowed_args=["io", "sheet_name"], version="2.0")
@Appender(_read_excel_doc)
def read_excel(
io,
sheet_name: str | int | list[IntStrT] | None = 0,
sheet_name: str | int | list[int] | list[str] | None = 0,
header: int | Sequence[int] | None = 0,
names=None,
index_col: int | Sequence[int] | None = None,
Expand All @@ -447,7 +479,7 @@ def read_excel(
convert_float: bool | None = None,
mangle_dupe_cols: bool = True,
storage_options: StorageOptions = None,
) -> DataFrame | dict[IntStrT, DataFrame]:
) -> DataFrame | dict[int, DataFrame] | dict[str, DataFrame]:

should_close = False
if not isinstance(io, ExcelFile):
Expand Down