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

Value Error when categorical column is of dtype "Categorical" #79

Open
manujosephv opened this issue May 26, 2022 · 2 comments
Open

Value Error when categorical column is of dtype "Categorical" #79

manujosephv opened this issue May 26, 2022 · 2 comments
Labels
bug Something isn't working good first issue Good for newcomers Open for Contribution

Comments

@manujosephv
Copy link
Owner

Describe the bug
When the categorical columns are of dtype Categorical in pandas, it throws this error.
ValueError: Cannot setitem on a Categorical with a new category, set the categories first

@stale
Copy link

stale bot commented Jan 17, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Jan 17, 2023
@manujosephv manujosephv added bug Something isn't working Open for Contribution labels Jan 19, 2023
@stale stale bot removed the wontfix This will not be worked on label Jan 19, 2023
@manujosephv manujosephv added the good first issue Good for newcomers label May 6, 2023
@DominikFilipiak
Copy link

Workaround: make sure that in your data frame all categorical columns are casted to string.

for c in cols_category:
    df[c] = df[c].astype("string") 
    df[c].fillna("na", inplace=True)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers Open for Contribution
Projects
None yet
Development

No branches or pull requests

2 participants