Skip to content

Commit

Permalink
Ignore rows where all values are empty strings
Browse files Browse the repository at this point in the history
This will do a better job of ignoring empty tsv lines, bu checking for
empty strings in addition to Nones (I think csv reader typically
produces empty strings).
  • Loading branch information
mslw committed Nov 21, 2023
1 parent ff3d225 commit 0408aaf
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions datalad_tabby/io/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,12 @@ def _load_many(
for row_id, row in enumerate(reader):
# row is a list of field, with only as many items
# as this particular row has columns
if not len(row) \
or row[0].startswith('#') \
or all(v is None for v in row):
if (
not len(row)
or row[0].startswith("#")
or all(v is None for v in row)
or all(v == "" for v in row)
):
# skip empty rows, rows with no key, or rows with
# a comment key
continue
Expand Down

0 comments on commit 0408aaf

Please sign in to comment.