JasonKessler / scattertext

Beautiful visualizations of how language differs among document types.
Apache License 2.0
2.23k stars 287 forks source link

Textrank example fails: 'numpy.ndarray' object has no attribute 'loc' #133

Open freddyheppell opened 11 months ago

freddyheppell commented 11 months ago

Thank you for submitting a bug report!

Steps to Reproduce

Run the demo_pytextrank.py file. It will crash with:

   '<b>%s</b> TextRank score rank: %s/%s' % (cat, term_ranks.loc[term, cat], corpus.get_num_metadata())
AttributeError: 'numpy.ndarray' object has no attribute 'loc'

This appears to be due to a mistake in the code (or some change in a library that's broken it), as term_ranks is a numpy array, not a Pandas dataframe.

Expected behavior

The example should run.

Environment

Additional context