pyLDAvis drop() takes from 1 to 2 positional arguments but 3 were given
unusualpyp opened this issue · 12 comments
Whether it is version 2.12.2 or version 3.4.0, it is the same.
This is an issue if you use the latest Pandas (currently 2.0.0
). If you downgrade to 1.5.3
it will work fine, just gives this warning:
/opt/conda/lib/python3.10/site-packages/pyLDAvis/_prepare.py:244: FutureWarning: In a future version of pandas all arguments of DataFrame.drop except for the argument 'labels' will be keyword-only.
by='saliency', ascending=False).head(R).drop('saliency', 1)
This should be fixed in _prepare.py
with the solution here: https://stackoverflow.com/questions/75997054/trying-to-visualize-topics-using-pyldavis-but-it-is-giving-drop-error
This is an issue if you use the latest Pandas (currently
2.0.0
). If you downgrade to1.5.3
it will work fine, just gives this warning:/opt/conda/lib/python3.10/site-packages/pyLDAvis/_prepare.py:244: FutureWarning: In a future version of pandas all arguments of DataFrame.drop except for the argument 'labels' will be keyword-only. by='saliency', ascending=False).head(R).drop('saliency', 1)
This should be fixed in
_prepare.py
with the solution here: https://stackoverflow.com/questions/75997054/trying-to-visualize-topics-using-pyldavis-but-it-is-giving-drop-error
I solved it following the link. Thank you.
I can not reproduce the error with pyLDAvis 3.4.0, pandas 2.0.0, python 3.11.3 even with .drop('saliency', 1)
import pyLDAvis.gensim_models
pyLDAvis.enable_notebook()
vis = pyLDAvis.gensim_models.prepare(lda, corpus, dictionary)
pyLDAvis.show(vis, local=False)
I'm getting this error too with pyLDAvis 3.4.0, pandas 2.0.0, python 3.11.3. I only started getting this error when I updated to python 3.11.
Please try v.3.4.1
https://github.com/bmabey/pyLDAvis/releases/tag/3.4.1
Upgrading to 3.4.1 did the trick. Thanks!
Ah.. In my case, I cannot avoid issue through updating package. Because my python version is 3.8.16 (**pyLDAvis 3.4.1 requires Python version above 3.9)
Does anyone solve this issue in python3.8 ?
*Python = 3.8.16
*Pandas = 2.0.1
*pyLDAvis = 3.4.0
Yup same here, while learning to code, had same error...
Python=3.11.5
Pandas=2.1.1
(hope this correct) - noob mode activated
with a simple drop term to delete columns and rows!
via Jupyter
TypeError: DataFrame.drop() takes from 1 to 2 positional arguments but 3 were given
Hi! I use pip to install most of my libraries. Would you be open to uploading the latest release to pip? I've had to manually make the changes that you mentioned here: https://github.com/bmabey/pyLDAvis/releases/tag/3.4.1