Skip to content

Commit 77c02e5

Browse files
committed
More type check fixes
1 parent f1958e0 commit 77c02e5

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

pandas/io/excel/_base.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -823,14 +823,14 @@ def _parse_sheet(
823823
# create an index map from the without-skiprows to the
824824
# original indexes.
825825
if skiprows is None:
826-
ixmap = range(len(data))
826+
ixmap = list(range(len(data)))
827827
elif is_integer(skiprows):
828-
ixmap = range(skiprows, len(data))
828+
ixmap = list(range(skiprows, len(data)))
829829
elif is_list_like(skiprows):
830-
skiprows_set = set(skiprows)
831-
ixmap = list(ix for ix, _ in enumerate(data) if ix not in skiprows_set)
830+
skiprows_set = set(cast(Sequence[int], skiprows))
831+
ixmap = [ix for ix, _ in enumerate(data) if ix not in skiprows_set]
832832
elif callable(skiprows):
833-
ixmap = list(ix for ix, _ in enumerate(data) if not skiprows(ix))
833+
ixmap = [ix for ix, _ in enumerate(data) if not skiprows(ix)]
834834
else:
835835
raise ValueError(
836836
"skiprows must be an integer or a list of integers"
@@ -847,21 +847,21 @@ def _parse_sheet(
847847
elif isinstance(index_col, int):
848848
index_col_set = {index_col}
849849
elif is_list_like(index_col):
850-
index_col_set = set(cast(Sequence[int], index_col))
850+
index_col_set = set(index_col)
851851
else:
852852
raise ValueError(
853853
"index_col must be a string, an integer or a list of integers"
854854
)
855855
has_index = len(index_col_set) > 0
856856
has_index_names = False
857857

858-
header_list: list[int]
858+
header_list: Sequence[int]
859859
if header is None:
860860
header_list = []
861-
elif is_integer(header):
861+
elif isinstance(header, int):
862862
header_list = [header]
863863
elif is_list_like(header):
864-
header_list = cast(Sequence[int], header)
864+
header_list = header
865865
else:
866866
raise ValueError(
867867
"header must be an integer or a list of integers"
@@ -897,7 +897,7 @@ def _parse_sheet(
897897

898898
if has_index:
899899
header_name, _ = pop_header_name(data[row1],
900-
index_col)
900+
sorted(index_col_set))
901901
if header_name:
902902
header_names.append(header_name)
903903

0 commit comments

Comments
 (0)