JasonKessler / scattertext

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

minimal example not working in python 3 #25

Closed arugola closed 6 years ago

arugola commented 6 years ago

Hi, unless I misunderstood how it works, the code below does produce error in Python 3.5.

tmp = pd.DataFrame([('a', 'this is the first sentence'), ('b', 'this is the second sentence')], columns=['category', 'text'])
corpus = st.CorpusFromPandas(tmp, category_col='category', text_col='text', nlp=nlp).build()
html = st.produce_scattertext_explorer(corpus, category='category', category_name='some_name', not_category_name='some_name2')

KeyError: 'category freq'

JasonKessler commented 6 years ago

The category parameter to produce_scattertext_explorer should be a value of the category column. In this case, either 'a' or 'b'.