Skip to content

Fix logic to allow all iterables (not only lists)#255

Merged
LilianBoulard merged 1 commit into
skrub-data:masterfrom
LilianBoulard:fix_get_features_names_out_gap
May 13, 2022
Merged

Fix logic to allow all iterables (not only lists)#255
LilianBoulard merged 1 commit into
skrub-data:masterfrom
LilianBoulard:fix_get_features_names_out_gap

Conversation

@LilianBoulard

Copy link
Copy Markdown
Member

This fixes an issue in the notebook, as seen here:

Traceback (most recent call last):
  File "/home/circleci/project/examples/01_dirty_categories.py", line 321, in <module>
    feature_names = sup_vec.get_feature_names()
  File "/home/circleci/project/dirty_cat/super_vectorizer.py", line 488, in get_feature_names
    return self.get_feature_names_out()
  File "/home/circleci/project/dirty_cat/super_vectorizer.py", line 456, in get_feature_names_out
    ct_feature_names = super().get_feature_names_out()
  File "/home/circleci/miniconda/envs/testenv/lib/python3.8/site-packages/sklearn/compose/_column_transformer.py", line 479, in get_feature_names_out
    feature_names_out = self._get_feature_name_out_for_transformer(
  File "/home/circleci/miniconda/envs/testenv/lib/python3.8/site-packages/sklearn/compose/_column_transformer.py", line 451, in _get_feature_name_out_for_transformer
    return trans.get_feature_names_out(names)
  File "/home/circleci/project/dirty_cat/gap_encoder.py", line 749, in get_feature_names_out
    elif col_names == 'auto':
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

it's a simple fix really, just reorganizing the logic so that not only lists are supported, but iterables in general.

@LilianBoulard LilianBoulard merged commit 3c7e344 into skrub-data:master May 13, 2022
@LilianBoulard LilianBoulard deleted the fix_get_features_names_out_gap branch July 5, 2022 08:58
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