Skip to content

adding test to check if rows are skipped when skip_blank_lines is set… #50843

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

Closed
Changes from 10 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
24 changes: 24 additions & 0 deletions pandas/tests/io/parser/common/test_common_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -862,3 +862,27 @@ def test_read_seek(all_parsers):
actual = parser.read_csv(file)
expected = parser.read_csv(StringIO(content))
tm.assert_frame_equal(actual, expected)


@pytest.mark.xfail
def test_read_csv_skip_blank_rows(all_parsers):
# GH22693
parser = all_parsers
csv_f = StringIO(
"""A, B, C, D
FOO, 1, 2, 3
FOO, 4, 5, 6
,,,
FOO, 7, 8, 9
, 10, 11, 12
,,,
"""
)

result = parser.read_csv(csv_f, skip_blank_lines=True)
expected = DataFrame(
[["FOO", 1, 2, 3], ["FOO", 4, 5, 6], ["FOO", 7, 8, 9], [np.nan, 10, 11, 12]],
columns=["A", "B", "C", "D"],
)

tm.assert_frame_equal(result, expected)