Skip to content

Commit

Permalink
parse-kp2023: refactor column_set_is_binary()
Browse files Browse the repository at this point in the history
Co-authored-by: Benjamin Capodanno <[email protected]>
  • Loading branch information
sallybg and bencap authored Apr 22, 2024
1 parent 05a6bb0 commit 9b71b08
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions lib/seattleflu/id3c/cli/command/clinical.py
Original file line number Diff line number Diff line change
Expand Up @@ -1107,11 +1107,7 @@ def column_set_is_binary(df: pd.DataFrame, prefix:str) -> bool:
otherwise returns False.
"""
cols = [c for c in df.columns if c.startswith(prefix)]
for c in cols:
if not np.isin(df[c].dropna().unique(), [0, 1]).all():
return False

return True
return all([np.isin(df[c].dropna().unique(), [0, 1]).all() for c in cols])


def map_icd10_codes(df: pd.DataFrame, sample_stream: str) -> pd.DataFrame:
Expand Down

0 comments on commit 9b71b08

Please sign in to comment.