diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index 2e42b70..96f008a 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -26,7 +26,6 @@ jobs: - name: show python path run: | python -c "import sys; print('\n'.join(sys.path))" - echo $PYTHONPATH - name: Install dependencies run: | python -m pip install --upgrade pip diff --git a/text2term/t2t.py b/text2term/t2t.py index fa247fc..ca89c34 100644 --- a/text2term/t2t.py +++ b/text2term/t2t.py @@ -265,13 +265,11 @@ def _add_tags_to_df(df, tags): def _filter_mappings(mappings_df, min_score): - new_df = pd.DataFrame(columns=mappings_df.columns) - for index, row in mappings_df.iterrows(): - if row['Mapping Score'] >= min_score: - new_df.loc[len(new_df.index)] = row + if mappings_df.empty: + return mappings_df + new_df = mappings_df.loc[mappings_df["Mapping Score"] >= min_score] return new_df - def _add_unmapped_terms(mappings_df, tags, source_terms, source_terms_ids): if mappings_df.size == 0: mapped = []