PyLdaVis : TypeError: cannot sort an Index object in-place, use sort_values instead
<p>I am trying to visualize LDA topics in Python using PyLDAVis but I can't seem to get it right. My model has a vocab size of 150K words and about 16 Million tokens were taken to train it.</p>

<p>I am doing it outside of an iPython notebook and this is the code that I wrote to do it.</p>

<pre><code>model_filename = "150k_LdaModel_topics_"+ topics +"_passes_"+passes +".model"

dictionary = gensim.corpora.Dictionary.load('LDADictSpecialRemoved150k.dict')
corpus = gensim.corpora.MmCorpus('LDACorpusSpecialRemoved150k.mm')
ldamodel = gensim.models.ldamodel.LdaModel.load(model_filename)

import pyLDAvis.gensim
vis = pyLDAvis.gensim.prepare(ldamodel, corpus, dictionary)
pyLDAvis.save_html(vis, "topic_viz_"+topics+"_passes_"+passes+".html")
</code></pre>

<p>I get the following error after 2-3 hours of running code on a high speed server with >30GBs of RAM. Can someone help where I am going wrong?</p>

<pre><code>Traceback (most recent call last):
  File "create_vis.py", line 36, in &lt;module&gt;
    vis = pyLDAvis.gensim.prepare(ldamodel, corpus, dictionary)
  File "/local/lib/python2.7/site-packages/pyLDAvis/gensim.py", line 110, in prepare
    return vis_prepare(**opts)
  File "/local/lib/python2.7/site-packages/pyLDAvis/_prepare.py", line 398, in prepare
    token_table        = _token_table(topic_info, term_topic_freq, vocab, term_frequency)
  File "/local/lib/python2.7/site-packages/pyLDAvis/_prepare.py", line 267, in _token_table
    term_ix.sort()
  File "/local/lib/python2.7/site-packages/pandas/indexes/base.py", line 1703, in sort
    raise TypeError("cannot sort an Index object in-place, use "
TypeError: cannot sort an Index object in-place, use sort_values instead
</code></pre>

<p>There was a problem with the LDAVis Code and upon reporting the issue, it has been resolved.</p>

python visualization lda gensim topic-modeling