@@ -894,7 +894,7 @@ def test_read_excel_bool_header_arg(self, read_ext):
894
894
with pytest .raises (TypeError , match = msg ):
895
895
pd .read_excel ("test1" + read_ext , header = arg )
896
896
897
- def test_read_excel_skiprows_list (self , read_ext ):
897
+ def test_read_excel_skiprows (self , read_ext ):
898
898
# GH 4903
899
899
if pd .read_excel .keywords ["engine" ] == "pyxlsb" :
900
900
pytest .xfail ("Sheets containing datetimes not supported by pyxlsb" )
@@ -920,6 +920,31 @@ def test_read_excel_skiprows_list(self, read_ext):
920
920
)
921
921
tm .assert_frame_equal (actual , expected )
922
922
923
+ # GH36435
924
+ actual = pd .read_excel (
925
+ "testskiprows" + read_ext ,
926
+ sheet_name = "skiprows_list" ,
927
+ skiprows = lambda x : x in [0 , 2 ],
928
+ )
929
+ tm .assert_frame_equal (actual , expected )
930
+
931
+ actual = pd .read_excel (
932
+ "testskiprows" + read_ext ,
933
+ sheet_name = "skiprows_list" ,
934
+ skiprows = 3 ,
935
+ names = ["a" , "b" , "c" , "d" ],
936
+ )
937
+ expected = DataFrame (
938
+ [
939
+ # [1, 2.5, pd.Timestamp("2015-01-01"), True],
940
+ [2 , 3.5 , pd .Timestamp ("2015-01-02" ), False ],
941
+ [3 , 4.5 , pd .Timestamp ("2015-01-03" ), False ],
942
+ [4 , 5.5 , pd .Timestamp ("2015-01-04" ), True ],
943
+ ],
944
+ columns = ["a" , "b" , "c" , "d" ],
945
+ )
946
+ tm .assert_frame_equal (actual , expected )
947
+
923
948
def test_read_excel_nrows (self , read_ext ):
924
949
# GH 16645
925
950
num_rows_to_pull = 5
0 commit comments