Boolean type conversion does not get called
- Lingua principale
- Python
- Stelle
- 155
- Fork
- 24
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
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.
Guida per i contributori
Apri la guida per i contributori
Valutazione
Questa issue non è ancora stata valutata.