Skip to content

DropFeatures fails when features_to_drop is a string  #406

Description

@noahjgreen295

Describe the bug
DropFeatures type hint and documentation says features_to_drop can take str or list as parameter, but instantiation fails when features_to_drop is a string.

To Reproduce
transformer=DropFeatures(features_to_drop="some_string")

Expected behavior
DropFeatures should instantiate successfully and drop the single feature specified by the string name when transform() or fit_transform() is called.

Screenshots
Error message:
ValueError: features_to_drop should be a list with the name of the variablesyou wish to drop from the dataframe.

Additional context
This is a simple fix, I am happy to take care of it. For convenience I would also convert the string to a single-element list when storing the attribute, for consistency.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions