Skip to content
This repository has been archived by the owner on Jul 11, 2023. It is now read-only.

Implemented blank preset for skip_rows #302

Merged
merged 3 commits into from Mar 16, 2020
Merged

Implemented blank preset for skip_rows #302

merged 3 commits into from Mar 16, 2020

Conversation

roll
Copy link
Member

@roll roll commented Mar 13, 2020


Hi @mcarans,

Here is an option for skipping completely blank rows based on goodtables-py definition of blank rows. It's based on the @cschloer's idea of supporting regex patterns.

Will it work for your case?

@mcarans
Copy link
Contributor

mcarans commented Mar 13, 2020

Thx @roll . Would you be able to add to the test so I can see what it does for a row with blank first column? eg.

def test_stream_skip_rows_preset():
    source = [['name', 'order'], ['', ''], [], ['John', 1], ['Alex', 2]], ['', 3]
    skip_rows = [{'type': 'preset', 'value': 'blank'}]
    with Stream(source, headers=1, skip_rows=skip_rows) as stream:
        assert stream.headers == ['name', 'order']
        assert stream.read() == [['John', 1], ['Alex', 2], ['', 3]]

Is it possible for a column to be None? If so, then the test also needs [None, 4].

@roll
Copy link
Member Author

roll commented Mar 16, 2020

@mcarans
Thanks, I've extended the tests

Copy link
Contributor

@mcarans mcarans left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@roll
Copy link
Member Author

roll commented Mar 16, 2020

Thanks!

@roll roll merged commit c5f36d3 into master Mar 16, 2020
@roll roll deleted the ignore-blank-rows branch March 17, 2020 16:39
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Breaking change in 1.35 - skip_rows
2 participants