alteryx / alteryx/woodwork

Boolean type conversion does not get called

オープン
#1,103 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Python
スター
155
フォーク
24
PR マージ指標
30日以内にマージされた PR はありません

説明

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.

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。