text_html_output_1.png
import category_encoders as ce

import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

training = pd.read_csv('../input/tabular-playground-series-aug-2022/train.csv')

training.fillna(0)

cat_cols = [col for col in training.columns if training[col].dtype == 'object']
cat_cols

training = training[cat_cols + ['failure']]
training

import category_encoders as ce
woe_encoder = ce.WOEEncoder(cols=cat_cols).fit(X=training[cat_cols], y=training['failure'])
temp = woe_encoder.transform(training[cat_cols])
temp