Skip to content

Commit

Permalink
added check for nans and a comment
Browse files Browse the repository at this point in the history
  • Loading branch information
sarthakpati committed May 22, 2023
1 parent a4eb233 commit a5ea57a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions GANDLF/cli/patch_extraction.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@
def parse_gandlf_csv(fpath):
df, _ = parseTrainingCSV(fpath, train=False)
df = df.drop_duplicates()
# nans can be easily removed using df.dropna(axis=1, how='all')
# we want to keep them because we want the user to check the CSV instead
# there might be cases where labels are accidentally removed for some subjects, but not all
assert (
df.isnull().values.any() == False
), "Data CSV contains null/nan values, please check."
for _, row in df.iterrows():
if "Label" in row:
yield row["SubjectID"], row["Channel_0"], row["Label"]
Expand Down

0 comments on commit a5ea57a

Please sign in to comment.