Skip to content

Column Selection: Compatibility with sklearn.compose.make_column_selector #239

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

Closed
mdancho84 opened this issue Feb 25, 2021 · 1 comment · Fixed by #246
Closed

Column Selection: Compatibility with sklearn.compose.make_column_selector #239

mdancho84 opened this issue Feb 25, 2021 · 1 comment · Fixed by #246
Assignees

Comments

@mdancho84
Copy link

Hey, awesome package. I'm planning to use it in my python course I'm developing.

Question

Is it possible to apply transformations by data type or with a column selection method similar to sklearn.compose.make_column_selector?

Example

A simple example is to select all numeric columns for scaling. With sklearn I'd do something like this:

column_transformer_scale_numeric = make_column_transformer(
    (StandardScaler(), make_column_selector(dtype_include = np.number)), 
    remainder = 'passthrough'
)

Ideally I'd be able to use the make_column_selector() from sklearn and apply it within the sklearn_pandas.DataFrameMapper().

mapper_scale = DataFrameMapper(
    features  = [
        (make_column_selector(dtype_include = np.number), StandardScaler())
    ]
)

Any thoughts on this? Also let me know if this has been addressed previously and if I just missed searching for it.

Thanks!

@ragrawal ragrawal self-assigned this Feb 28, 2021
@ragrawal
Copy link
Collaborator

Hi @mdancho84 , no this is not yet implemented. The ideas was previously discussed but we never got it implemented. Let me think about it. One workaround for now is to use gen_feature as shown in README. Let me know if that works for you

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 a pull request may close this issue.

2 participants