Skip to content

TST: tests for list skiprows in read_excel #11340

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 16, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added pandas/io/tests/data/testskiprows.xls
Binary file not shown.
Binary file added pandas/io/tests/data/testskiprows.xlsm
Binary file not shown.
Binary file added pandas/io/tests/data/testskiprows.xlsx
Binary file not shown.
15 changes: 15 additions & 0 deletions pandas/io/tests/test_excel.py
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,21 @@ def test_read_excel_chunksize(self):
pd.read_excel(os.path.join(self.dirpath, 'test1' + self.ext),
chunksize=100)

def test_read_excel_skiprows_list(self):
#GH 4903
actual = pd.read_excel(os.path.join(self.dirpath, 'testskiprows' + self.ext),
'skiprows_list', skiprows=[0,2])
expected = DataFrame([[1, 2.5, pd.Timestamp('2015-01-01'), True],
[2, 3.5, pd.Timestamp('2015-01-02'), False],
[3, 4.5, pd.Timestamp('2015-01-03'), False],
[4, 5.5, pd.Timestamp('2015-01-04'), True]],
columns = ['a','b','c','d'])
tm.assert_frame_equal(actual, expected)

actual = pd.read_excel(os.path.join(self.dirpath, 'testskiprows' + self.ext),
'skiprows_list', skiprows=np.array([0,2]))
tm.assert_frame_equal(actual, expected)

class XlsReaderTests(XlrdTests, tm.TestCase):
ext = '.xls'
engine_name = 'xlrd'
Expand Down