Skip to content

Commit de75c25

Browse files
committed
read_excel: optimization
ixmap was being always converted into a list. Now if it is a range it is left unchanged.
1 parent c2dab1b commit de75c25

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

pandas/io/excel/_base.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -830,10 +830,11 @@ def _parse_sheet(
830830
# header indexes reference rows after removing skiprows, so we
831831
# create an index map from the without-skiprows to the
832832
# original indexes.
833+
ixmap: Union(range, list[int])
833834
if skiprows is None:
834-
ixmap = list(range(len(data)))
835+
ixmap = range(len(data))
835836
elif is_integer(skiprows):
836-
ixmap = list(range(skiprows, len(data)))
837+
ixmap = range(skiprows, len(data))
837838
elif is_list_like(skiprows):
838839
skiprows_set = set(cast(Sequence[int], skiprows))
839840
ixmap = [ix for ix in range(len(data)) if ix not in skiprows_set]
Binary file not shown.

0 commit comments

Comments
 (0)