alteryx / alteryx/woodwork

Boolean type conversion does not get called

Ouverte
#1,103 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
Python
Étoiles
155
Forks
24
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

If a user supplies specific `variable_types` for a Boolean variable that has an underlying "object" dtype, and that include type information as kwargs, the associated logic in `Entity.entityset_convert_variable_type` does not get called. This is because Booleans are a subclass of Discrete, and the "object" dtype is in "_categorical_types".

Relevant code is in `Entity.convert_variable_types()`.

What this means is that if I have a dataframe with a string column that I call a Boolean:

```
df = pd.DataFrame({'boolean': ['y', 'n', 'y'], 'id': [0,1,2]})
variable_types .= {'boolean': (ft.variable_types.Boolean, {'true_val': 'y', 'false_val': 'n'})}
es.entity_from_dataframe('test', df, index='id', variable_types=variable_types)
```

The column remains a string, does not get converted to a Boolean, and so features like `PercentTrue` fail because they expect boolean inputs.

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.