text_html_output_1.png
from sklearn.preprocessing import OneHotEncoder

x_train.shape

x_test.shape

from sklearn.preprocessing import OneHotEncoder
ohe = OneHotEncoder(drop='first')
x_train_array = ohe.fit_transform(x_train[['sex', 'smoker', 'region']]).toarray()
x_test_array = ohe.transform(x_test[['sex', 'smoker', 'region']]).toarray()

ohe.categories_