Skip to content

Conversation

mepearson
Copy link

@mepearson mepearson commented Mar 22, 2024

Update Multimodal documentation to add an axis keyword for the drop function. This addresses issue #1884

Existing Code:

# Extract dataframe
df = topic_model.get_topic_info().drop("Representative_Docs", 1).drop("Name", 1)

Suggested Code:

# Extract dataframe  
df = topic_model.get_topic_info().drop(["Representative_Docs","Name"], axis=1)

This corrects the following error caused by the need for keyword arguments in newer versions of pandas. Columns to drop were gathered into a single list just for simplicity.

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[12], line 1
----> 1 df.drop("Representative_Docs", 1).drop("Name", 1)

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

@MaartenGr
Copy link
Owner

Thanks for the PR! Do you know why this change is necessary? The reason why I ask is that this might relate to specific versions of pandas as this piece of code did work before. Did you test this?

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

Successfully merging this pull request may close these issues.

2 participants