Closed shyamalschandra closed 8 years ago
I can't replicate this. How did you install the package?
Also, make sure that there's not file or folder named "scattertext.py" or "scattertext" in your working directory.
I used pip.
Here is the error I am getting now that I removed the scattertext.pyc file from the cwd:
Traceback (most recent call last):
File "stextt.py", line 13, in <module>
filtered_term_doc_mat = (ST.TermDocMatrixFilter(pmi_threshold_coef = 3, min_freq = 10).filter(term_doc_mat))
TypeError: __init__() got an unexpected keyword argument 'min_freq'
I will look into the code later today. Thanks for responding so quickly!
Ah. Looks like I forgot to update the param name in the example after changing it in a new version. I'll go ahead and change it, but use minimum_term_freq instead of min_freq.
Okay, I changed the parameter name to minimum_term_freq instead of min_freq and reran the code and got the following error:
iMac:Desktop shyamalsuhanachandra$ python stextt.py
Traceback (most recent call last):
File "stextt.py", line 15, in <module>
scatter_chart_data = (ST.ScatterChart(filtered_term_doc_mat).to_dict('text1', category_name='text1', not_category_name='text2'))
File "/usr/local/lib/python2.7/site-packages/scattertext/ScatterChart.py", line 61, in to_dict
df = self._build_dataframe_for_drawing(all_categories, category, scores)
File "/usr/local/lib/python2.7/site-packages/scattertext/ScatterChart.py", line 188, in _build_dataframe_for_drawing
df[df[all_categories].sum(axis=1) > self.minimum_term_frequency],
File "/usr/local/lib/python2.7/site-packages/pandas/core/frame.py", line 1991, in __getitem__
return self._getitem_array(key)
File "/usr/local/lib/python2.7/site-packages/pandas/core/frame.py", line 2035, in _getitem_array
indexer = self.ix._convert_to_indexer(key, axis=1)
File "/usr/local/lib/python2.7/site-packages/pandas/core/indexing.py", line 1214, in _convert_to_indexer
raise KeyError('%s not in index' % objarr[mask])
KeyError: "['text1 freq'] not in index"
Any thoughts?
I changed the names to text1 and text2 and it runs successfully.
I just took two text datasets and fed them into the boiler-plate code that was shown in the jupyter notebook example but I am getting the following error:
Do you know what could be the problem? What should I do?
Here is the code: