text_html_output_1.png
from sklearn.compose import ColumnTransformer

from sklearn.preprocessing import KBinsDiscretizer

import pandas as pd

df = pd.read_csv('/kaggle/input/titanic/train.csv', usecols=['Age', 'Fare', 'Survived'])

kbin_age = KBinsDiscretizer(n_bins=15, encode='ordinal', strategy='quantile')
kbin_fare = KBinsDiscretizer(n_bins=15, encode='ordinal', strategy='quantile')

trf = ColumnTransformer([('first', kbin_age, [0]), ('second', kbin_fare, [1])])

X_train_trf = trf.fit_transform(X_train)
X_test_trf = trf.transform(X_test)

output = pd.DataFrame({'age': X_train['Age'], 'age_trf': X_train_trf[:, 0], 'fare': X_train['Fare'], 'fare_trf': X_train_trf[:, 1]})

output.sample(5)