Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: DataFrame.drop() takes from 1 to 2 positional arguments but 3 were given #248

Closed
wy6688 opened this issue Apr 23, 2023 · 2 comments

Comments

@wy6688
Copy link

wy6688 commented Apr 23, 2023

26 # Quick fix for red bar width bug. We calculate the
42File c:\tools\miniconda3\envs\ml4t310\lib\site-packages\pyLDAvis_prepare.py:432, in prepare(topic_term_dists, doc_topic_dists, doc_lengths, vocab, term_frequency, R, lambda_step, mds, n_jobs, plot_opts, sort_topics, start_index)
47 # term frequencies internally, using the topic term distributions and the
428 # topic frequencies, rather than using the user-supplied term frequencies.
429 # For a detailed discussion, see: cpsievert/LDAvis#41
430 term_frequency = np.sum(term_topic_freq, axis=0)
--> 432 topic_info = _topic_info(topic_term_dists, topic_proportion,
433 term_frequency, term_topic_freq, vocab, lambda_step, R,
434 n_jobs, start_index)
435 token_table = _token_table(topic_info, term_topic_freq, vocab, term_frequency, start_index)
436 topic_coordinates = _topic_coordinates(mds, topic_term_dists, topic_proportion, start_index)

File c:\tools\miniconda3\envs\ml4t310\lib\site-packages\pyLDAvis_prepare.py:244, in _topic_info(topic_term_dists, topic_proportion, term_frequency, term_topic_freq, vocab, lambda_step, R, n_jobs, start_index)
236 # Order the terms for the "default" view by decreasing saliency:
237 default_term_info = pd.DataFrame({
238 'saliency': saliency,
239 'Term': vocab,
240 'Freq': term_frequency,
241 'Total': term_frequency,
242 'Category': 'Default'})
243 default_term_info = default_term_info.sort_values(
--> 244 by='saliency', ascending=False).head(R).drop('saliency', 1)
245 # Rounding Freq and Total to integer values to match LDAvis code:
246 default_term_info['Freq'] = np.floor(default_term_info['Freq'])

TypeError: DataFrame.drop() takes from 1 to 2 positional arguments but 3 were given

=====================================================

In the new Pandas 2.x release, the drop shall use .drop(saliency, axis=1), can someone fix this issues in next release?

@msusol
Copy link
Collaborator

msusol commented Apr 23, 2023

#247

@wy6688
Copy link
Author

wy6688 commented Apr 23, 2023

thanks

@msusol msusol closed this as completed Apr 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants