Skip to content

Commit

Permalink
fixes #534
Browse files Browse the repository at this point in the history
  • Loading branch information
amaiya committed Aug 22, 2024
1 parent 5a08165 commit b36a72a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Most recent releases are shown at the top. Each release shows:

### fixed:
- Update `test_lda.py` due to changes in `numpy` (#533)
- Ensure `TopicModel.filter` returns `pd.DataFrame` if supplied (#534)


## 0.41.4 (2024-06-18)
Expand Down
11 changes: 7 additions & 4 deletions ktrain/text/eda.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,11 +369,14 @@ def filter(self, obj):
"Length of obj is not consistent with the number of documents "
+ "supplied to get_topic_model"
)
# obj = np.array(obj) if isinstance(obj, list) else obj
# return obj[self.bool_array]
from itertools import compress
if isinstance(obj, pd.DataFrame):
# ensure DataFrame is returned (#534)
return obj[self.bool_array]
else:
# reduces memory footprint (#531)
from itertools import compress

return list(compress(obj, self.bool_array))
return list(compress(obj, self.bool_array))

def get_docs(self, topic_ids=[], doc_ids=[], rank=False):
"""
Expand Down

0 comments on commit b36a72a

Please sign in to comment.