Skip to content
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

ignore empty rows flag #50

Closed
avilella opened this issue Sep 13, 2018 · 2 comments
Closed

ignore empty rows flag #50

avilella opened this issue Sep 13, 2018 · 2 comments

Comments

@avilella
Copy link

Hi,

I have a use case where I am using csvtk on a table from an .xlsx file where there could be rows at the bottom of the worksheet that are completely empty, e.g. where all the fields have empty cells. This is common if people manually edit the worksheet and just leave the empty rows in there rather than explicitly deleting them.

Could there be a flag in csvtk so that the empty rows are ignored in the csvtk operation?

There may be a workaround using csvtk filter or some other operation, but I couldn't find one.

E.g. in this example, all the values for the last two rows are empty

Col1,Col2,Col3
A,1,2
B,2,3
C,3,4
,,
,,

Currently when applying any operation, e.g. csvtk freq, it takes into account the empty rows:

csvtk freq -f 1 example_empty_rows.csv 
Col1,frequency
A,1
B,1
C,1
,2

It would be great to have an --ignore-empty e.g. -e flag that would filter out the rows where all fields are empty, then return the equivalent of the operation, e.g.:

csvtk freq --ignore-empty -f 1 example_empty_rows.csv 
Col1,frequency
A,1
B,1
C,1
shenwei356 added a commit that referenced this issue Sep 13, 2018
@shenwei356
Copy link
Owner

v0.15.0-dev3

@avilella
Copy link
Author

I tested it and got it working. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants