Skip to content

Commit bd2248c

Browse files
Merge pull request #11340 from chris-b1/excel-skiprows-list
TST: tests for list skiprows in read_excel
2 parents 7d90236 + af08c13 commit bd2248c

File tree

4 files changed

+15
-0
lines changed

4 files changed

+15
-0
lines changed

pandas/io/tests/data/testskiprows.xls

22 KB
Binary file not shown.
8.09 KB
Binary file not shown.
8.06 KB
Binary file not shown.

pandas/io/tests/test_excel.py

+15
Original file line numberDiff line numberDiff line change
@@ -660,6 +660,21 @@ def test_read_excel_chunksize(self):
660660
pd.read_excel(os.path.join(self.dirpath, 'test1' + self.ext),
661661
chunksize=100)
662662

663+
def test_read_excel_skiprows_list(self):
664+
#GH 4903
665+
actual = pd.read_excel(os.path.join(self.dirpath, 'testskiprows' + self.ext),
666+
'skiprows_list', skiprows=[0,2])
667+
expected = DataFrame([[1, 2.5, pd.Timestamp('2015-01-01'), True],
668+
[2, 3.5, pd.Timestamp('2015-01-02'), False],
669+
[3, 4.5, pd.Timestamp('2015-01-03'), False],
670+
[4, 5.5, pd.Timestamp('2015-01-04'), True]],
671+
columns = ['a','b','c','d'])
672+
tm.assert_frame_equal(actual, expected)
673+
674+
actual = pd.read_excel(os.path.join(self.dirpath, 'testskiprows' + self.ext),
675+
'skiprows_list', skiprows=np.array([0,2]))
676+
tm.assert_frame_equal(actual, expected)
677+
663678
class XlsReaderTests(XlrdTests, tm.TestCase):
664679
ext = '.xls'
665680
engine_name = 'xlrd'

0 commit comments

Comments
 (0)