Skip to content

Commit

Permalink
Fix issue accessing df when mappings df is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
rsgoncalves committed Oct 13, 2023
1 parent 997e4a6 commit 66cc573
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion text2term/t2t.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,10 @@ def _filter_mappings(mappings_df, min_score):


def _add_unmapped_terms(mappings_df, tags, source_terms, source_terms_ids):
mapped = pd.unique(mappings_df["Source Term"])
if mappings_df.size == 0:
mapped = ()
else:
mapped = pd.unique(mappings_df["Source Term"])
for (term, term_id) in zip(source_terms, source_terms_ids):
if term not in mapped:
non_mapping = TermMapping(term, term_id, "", "", 0)
Expand Down

0 comments on commit 66cc573

Please sign in to comment.