bmabey / pyLDAvis

Python library for interactive topic model visualization. Port of the R LDAvis package.
BSD 3-Clause "New" or "Revised" License
1.8k stars 361 forks source link

pyLDAvis drop() takes from 1 to 2 positional arguments but 3 were given #247

Closed unusualpyp closed 1 year ago

unusualpyp commented 1 year ago

image Excuse me, how to solve this problem?

unusualpyp commented 1 year ago

Whether it is version 2.12.2 or version 3.4.0, it is the same.

alee2233 commented 1 year ago

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

sguo28 commented 1 year ago

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

I solved it following the link. Thank you.

msusol commented 1 year ago

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)
rhnprabhune commented 1 year ago

image

with python 3.9.16 version. Am I missing something here ? Thank you

bsherin commented 1 year ago

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.

msusol commented 1 year ago

Please try v.3.4.1 https://github.com/bmabey/pyLDAvis/releases/tag/3.4.1

bsherin commented 1 year ago

Upgrading to 3.4.1 did the trick. Thanks!

huni1023 commented 11 months ago

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

miguelcferreira commented 11 months ago

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

Freddy1980Unal commented 11 months ago

Buenas tardes, cómo puedo solucionar esta situación, muchas gracias TypeError: DataFrame.drop() takes from 1 to 2 positional arguments but 3 were given

python

lamthuyvo commented 1 month ago

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