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

fix: fct_collapse preserves missing values #262

Merged
merged 1 commit into from
Aug 14, 2020
Merged

Conversation

machow
Copy link
Owner

@machow machow commented Aug 11, 2020

A cure for the sadness felt by fct_collapse raised in #124

import pandas as pd
from siuba.dply.forcats import fct_collapse

test = pd.Series(['Hip-Hop/Rap', 'East Coast Rap', "Gangsta Rap", None])
fct = fct_collapse(test, {'Hip-Hop/Rap': ['East Coast Rap', "Gangsta Rap"]})
fct

# ['Hip-Hop/Rap', 'Hip-Hop/Rap', 'Hip-Hop/Rap', NaN]
# Categories (1, object): ['Hip-Hop/Rap']

@machow machow merged commit 8e12b4a into master Aug 14, 2020
@machow machow deleted the fix-forcats-fct-collapse branch August 14, 2020 23:03
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.

1 participant