There's one point to be aware of when dealing with ColumnTransformer, which is reported within the doc as follows:
The order of the columns in the transformed feature matrix follows the order of how the columns are specified in the transformers list.
That's the reason why your ColumnTransformer instance messes things up. Indeed, consider this simplified example which resembles your setting:
import numpy as np
import pandas as pd
from sklearn.compose import ColumnTransformer, make_column_selector
from sklearn.preprocessing import StandardScaler
from sklearn.pipeline import Pipeline
df = pd.DataFrame({
'date': ['02.01.2013', '03.01.2013', '05.01.2013', '06.01.2013', '15.01.2013'],
'date_block_num': ['0', '0', '0', '0', '0'],
'shop_id': ['59', '25', '25', '25', '25'],
'item_id': ['22514', '2252', '2252', '2254', '2255'],
'item_price': [999.00, 899.00, 899.00, 1709.05, 1099.00]})
ct = ColumnTransformer([
('std_scaler', StandardScaler(), make_column_selector(dtype_include=np.number))],
remainder='passthrough')
pd.DataFrame(ct.fit_transform(df), columns=ct.get_feature_names_out())

As you might notice, the first column in the transformed dataframe turns out to be the numeric one, i.e. the one which undergoes the scaling (and the first in the transformers list).
Conversely, here's an example of how you can bypass such issue by postponing the scaling on numeric variables after passing through all the string variables and thus ensuring the possibility of getting the columns in your desired order:
ct = ColumnTransformer([
('pass', 'passthrough', make_column_selector(dtype_include=object)),
('std_scaler', StandardScaler(), make_column_selector(dtype_include=np.number))
])
pd.DataFrame(ct.fit_transform(df), columns=ct.get_feature_names_out())

To complete the picture, here is an attempt to reproduce your Pipeline (though the custom transformer is for sure slightly different from yours):
from sklearn.base import BaseEstimator, TransformerMixin
class PercentOverTotalAttributeWholeAdder(BaseEstimator, TransformerMixin):
def __init__(self, attribute_percent_name='shop_id', new_attribute_name='%_item_cnt_day_per_shop'):
self.attribute_percent_name = attribute_percent_name
self.new_attribute_name = new_attribute_name
def fit(self, X, y=None):
return self
def transform(self, X, y=None):
df[self.new_attribute_name] = df.groupby(by=self.attribute_percent_name)[self.attribute_percent_name].transform('count') / df.shape[0]
return df
ct_pipe = ColumnTransformer([
('pass', 'passthrough', make_column_selector(dtype_include=object)),
('std_scaler', StandardScaler(), make_column_selector(dtype_include=np.number))
], verbose_feature_names_out=False)
pipe = Pipeline([
('percent_item_cnt_day_per_shop', PercentOverTotalAttributeWholeAdder(
attribute_percent_name='shop_id',
new_attribute_name='%_item_cnt_day_per_shop')
),
('percent_item_cnt_day_per_item', PercentOverTotalAttributeWholeAdder(
attribute_percent_name='item_id',
new_attribute_name='%_item_cnt_day_per_item')
),
('column_trans', ct_pipe),
])
pd.DataFrame(pipe.fit_transform(df), columns=pipe[-1].get_feature_names_out())

As a final remark, observe that the verbose_feature_names_out=False parameter ensures that the names of the columns of the transformed dataframe do not show prefixes which refer to the different transformers in ColumnTransformer.
There's one point to be aware of when dealing with ColumnTransformer, which is reported within the doc as follows:
The order of the columns in the transformed feature matrix follows the order of how the columns are specified in the transformers list.
That's the reason why your ColumnTransformer instance messes things up. Indeed, consider this simplified example which resembles your setting:
import numpy as np
import pandas as pd
from sklearn.compose import ColumnTransformer, make_column_selector
from sklearn.preprocessing import StandardScaler
from sklearn.pipeline import Pipeline
df = pd.DataFrame({
'date': ['02.01.2013', '03.01.2013', '05.01.2013', '06.01.2013', '15.01.2013'],
'date_block_num': ['0', '0', '0', '0', '0'],
'shop_id': ['59', '25', '25', '25', '25'],
'item_id': ['22514', '2252', '2252', '2254', '2255'],
'item_price': [999.00, 899.00, 899.00, 1709.05, 1099.00]})
ct = ColumnTransformer([
('std_scaler', StandardScaler(), make_column_selector(dtype_include=np.number))],
remainder='passthrough')
pd.DataFrame(ct.fit_transform(df), columns=ct.get_feature_names_out())

As you might notice, the first column in the transformed dataframe turns out to be the numeric one, i.e. the one which undergoes the scaling (and the first in the transformers list).
Conversely, here's an example of how you can bypass such issue by postponing the scaling on numeric variables after passing through all the string variables and thus ensuring the possibility of getting the columns in your desired order:
ct = ColumnTransformer([
('pass', 'passthrough', make_column_selector(dtype_include=object)),
('std_scaler', StandardScaler(), make_column_selector(dtype_include=np.number))
])
pd.DataFrame(ct.fit_transform(df), columns=ct.get_feature_names_out())

To complete the picture, here is an attempt to reproduce your Pipeline (though the custom transformer is for sure slightly different from yours):
from sklearn.base import BaseEstimator, TransformerMixin
class PercentOverTotalAttributeWholeAdder(BaseEstimator, TransformerMixin):
def __init__(self, attribute_percent_name='shop_id', new_attribute_name='%_item_cnt_day_per_shop'):
self.attribute_percent_name = attribute_percent_name
self.new_attribute_name = new_attribute_name
def fit(self, X, y=None):
return self
def transform(self, X, y=None):
df[self.new_attribute_name] = df.groupby(by=self.attribute_percent_name)[self.attribute_percent_name].transform('count') / df.shape[0]
return df
ct_pipe = ColumnTransformer([
('pass', 'passthrough', make_column_selector(dtype_include=object)),
('std_scaler', StandardScaler(), make_column_selector(dtype_include=np.number))
], verbose_feature_names_out=False)
pipe = Pipeline([
('percent_item_cnt_day_per_shop', PercentOverTotalAttributeWholeAdder(
attribute_percent_name='shop_id',
new_attribute_name='%_item_cnt_day_per_shop')
),
('percent_item_cnt_day_per_item', PercentOverTotalAttributeWholeAdder(
attribute_percent_name='item_id',
new_attribute_name='%_item_cnt_day_per_item')
),
('column_trans', ct_pipe),
])
pd.DataFrame(pipe.fit_transform(df), columns=pipe[-1].get_feature_names_out())

As a final remark, observe that the verbose_feature_names_out=False parameter ensures that the names of the columns of the transformed dataframe do not show prefixes which refer to the different transformers in ColumnTransformer.
Answer using scikit-learn 1.2.1
In scikit-learn 1.2 it's possible to set the output of the ColumnTransformer to a pandas dataframe, avoiding this transformation in a second step. Besides this, in the answer proposed by @amiola the ColumnTransformer makes use of a passthrough phase to preserve the order of string-type columns with respect to numeric ones, but this only works if all the string-type columns are before the numerics. To show this I use the same example converting the shop_id column to numeric:
import numpy as np
import pandas as pd
from sklearn.compose import ColumnTransformer, make_column_selector
from sklearn.preprocessing import StandardScaler
from sklearn.pipeline import Pipeline
df = pd.DataFrame({
'date': ['02.01.2013', '03.01.2013', '05.01.2013', '06.01.2013', '15.01.2013'],
'date_block_num': ['0', '0', '0', '0', '0'],
'shop_id': [59, 25, 25, 25, 25],
'item_id': ['22514', '2252', '2252', '2254', '2255'],
'item_price': [999.00, 899.00, 899.00, 1709.05, 1099.00]})
ct = ColumnTransformer([
('pass', 'passthrough', make_column_selector(dtype_include=object)),
('std_scaler', StandardScaler(), make_column_selector(dtype_include=np.number))
]).set_output(transform='pandas')
out_df = ct.fit_transform(df)
out_df
| pass__date | pass__date_block_num | pass__item_id | std_scaler__shop_id | std_scaler__item_price | |
|---|---|---|---|---|---|
| 0 | 02.01.2013 | 0 | 22514 | 2.0 | -0.402369 |
| 1 | 03.01.2013 | 0 | 2252 | -0.5 | -0.732153 |
| 2 | 05.01.2013 | 0 | 2252 | -0.5 | -0.732153 |
| 3 | 06.01.2013 | 0 | 2254 | -0.5 | 1.939261 |
| 4 | 15.01.2013 | 0 | 2255 | -0.5 | -0.072585 |
As it's possible to see the shop_id column is moved to the end, for the same reason also explained in amiola's answer (i.e. columns are reordered following the order of the transformation in the ColumnTrasnformer). To overcome this issue, you can reorder dataframe columns after the transformation with verbose_feature_names_out set to False to preserve the same starting column names (beware that those names must be unique, see docs). There's also no need to create a specific passthrough step.
ct = ColumnTransformer([
('std_scaler', StandardScaler(), make_column_selector(dtype_include=np.number))],
remainder='passthrough',
verbose_feature_names_out=False).set_output(transform='pandas')
out_df = ct.fit_transform(df)
out_df = out_df[df.columns]
out_df
| date | date_block_num | shop_id | item_id | item_price | |
|---|---|---|---|---|---|
| 0 | 02.01.2013 | 0 | 2.0 | 22514 | -0.402369 |
| 1 | 03.01.2013 | 0 | -0.5 | 2252 | -0.732153 |
| 2 | 05.01.2013 | 0 | -0.5 | 2252 | -0.732153 |
| 3 | 06.01.2013 | 0 | -0.5 | 2254 | 1.939261 |
| 4 | 15.01.2013 | 0 | -0.5 | 2255 | -0.072585 |
What I understand from the error message is that X_train.columns and df_resp.columns are not the same but .predict() needs them to be.
In order to force this equality you could pass the column list of X_train as an argument when creating the dataframe:
pd.DataFrame(data=request_data, columns=X_train.columns)
You can use following generic function in order to sort columns correctly :
def rearrange_columns(df, first_order="categorical"):
"""
ColumnTransformer of scikit-learn Pipeline changes the order of the dataframe columns.
Use this function to reorder the features columns to be consistent with the ouptut of the pipeline
"""
cat_ix = [ii for ii, col in enumerate(df.columns.values) if df[col].dtypes=="object"]
num_ix = [ii for ii, col in enumerate(df.columns.values) if ii not in cat_ix]
new_order = cat_ix + num_ix if first_order == "categorical" else num_ix + cat_ix
return [df.columns.values[ii] for ii in new_order]
As quickly sketched in the comment there are a couple of considerations to be done on your example:
method
.fit_transform()generally returns either a sparse matrix or a numpy array. Returning a sparse matrix serves the purpose of saving memory; think to the example where you one-hot-encode a categorical attribute with many categories. You'll end up having a matrix with many columns and a single non-zero entry per row; with a sparse matrix you can store the location of the non-zero element only. In these situation you can call.toarray()on the output of.fit_transform()to get a numpy array back to be passed to thepd.DataFrameconstructor.Actually, on a five-rows dataset similar to the one you provided
df = pd.DataFrame({ 'department': ['operations', 'operations', 'support', 'logistics', 'sales'], 'review': [0.577569, 0.751900, 0.722548, 0.675158, 0.676203], 'projects': [3, 3, 3, 4, 3], 'salary': ['low', 'medium', 'medium', 'low', 'high'], 'satisfaction': [0.626759, 0.751900, 0.722548, 0.675158, 0.676203], 'bonus': [0, 0, 0, 0, 1], 'avg_hrs_month': [180.866070, 182.708149, 184.416084, 188.707545, 179.821083], 'left': [0, 0, 1, 0, 0] }) ord_features = ["salary"] ordinal_transformer = OrdinalEncoder() cat_features = ["department"] categorical_transformer = OneHotEncoder(handle_unknown="ignore") ct = ColumnTransformer(transformers=[ ("ord", ordinal_transformer, ord_features), ("cat", categorical_transformer, cat_features), ])I can't reproduce your issue (namely, I directly obtain a numpy array), but basically
pd.DataFrame(ct.fit_transform(df).toarray())should work for your case. This is the output you would get:
As you can see, with respect to your expected output, this only contains the transformed (ordinally encoded) salary column as first column and the transformed (one-hot-encoded) department column from the second to the last column. That's because, as you can see within the docs, parameter
remainderis set to'drop'by default, which implies that all columns which are not subject to transformation are dropped. To avoid this, you should set it to'passthrough'; this will help you to transform the columns you need and keep the other untouched.ct = ColumnTransformer(transformers=[ ("ord", ordinal_transformer, ord_features), ("cat", categorical_transformer, cat_features )], remainder='passthrough' )This would be the output of your
pd.DataFrame(ct.fit_transform(df).toarray())in such a case:
Again, as you can see also column order is not the one you would expect after the transformation. Long story short, that's because in a
ColumnTransformer
The order of the columns in the transformed feature matrix follows the order of how the columns are specified in the transformers list. Columns of the original feature matrix that are not specified are dropped from the resulting transformed feature matrix, unless specified in the passthrough keyword. Those columns specified with passthrough are added at the right to the output of the transformers.
I would aggest reading Preserve column order after applying sklearn.compose.ColumnTransformer at this proposal.
- Eventually, for what concerns column names you should probably apply a custom solution passing what you want directly to the
columnsparameter to be passed to thepd.DataFrameconstructor. Indeed,OrdinalEncoder(differently fromOneHotEncoder) does not provide a.get_feature_names_out()method that makes it generally easy to passcolumns=ct.get_feature_names_out()to thepd.DataFrameconstructor. See ColumnTransformer & Pipeline with OHE - Is the OHE encoded field retained or removed after ct is performed? for an example of its usage.
Update 10/2022 - sklearn version 1.2.dev0
With sklearn version 1.2.0 it will be possible to solve the problem of returning a DataFrame when transforming a ColumnTransformer instance much more easily. Such version has not been released yet, but you can test the following in dev (version 1.2.dev0), by installing the nightly builds as such:
pip install --pre --extra-index https://pypi.anaconda.org/scipy-wheels-nightly/simple scikit-learn -U
The ColumnTransformer (and other transformers as well) now exposes a .set_output() method which gives the possibility to configure a transformer to output pandas DataFrames, by passing parameter transform='pandas' to it.
Therefore, the example becomes:
import pandas as pd
from sklearn.preprocessing import LabelEncoder, OneHotEncoder, OrdinalEncoder
from sklearn.compose import ColumnTransformer
from sklearn.pipeline import Pipeline
from sklearn.model_selection import train_test_split, GridSearchCV
from sklearn.ensemble import RandomForestClassifier
df = pd.DataFrame({
'department': ['operations', 'operations', 'support', 'logistics', 'sales'],
'review': [0.577569, 0.751900, 0.722548, 0.675158, 0.676203],
'projects': [3, 3, 3, 4, 3],
'salary': ['low', 'medium', 'medium', 'low', 'high'],
'satisfaction': [0.626759, 0.751900, 0.722548, 0.675158, 0.676203],
'bonus': [0, 0, 0, 0, 1],
'avg_hrs_month': [180.866070, 182.708149, 184.416084, 188.707545, 179.821083],
'left': [0, 0, 1, 0, 0]
})
ord_features = ["salary"]
ordinal_transformer = OrdinalEncoder()
cat_features = ["department"]
categorical_transformer = OneHotEncoder(sparse_output=False, handle_unknown="ignore")
ct = ColumnTransformer(transformers=[
("ord", ordinal_transformer, ord_features),
("cat", categorical_transformer, cat_features )],
remainder='passthrough'
)
ct.set_output('pandas')
df_pandas = ct.fit_transform(df)
df_pandas

The output also becomes much easier to read as it has proper column names (indeed, at each step, the transformers of which ColumnTransformer is made of do have the attribute feature_names_in_; so you don't lose column names anymore while transforming the input).
Last note. Observe that the example now requires parameter sparse_output=False to be passed to the OneHotEncoder instance in order to work.
This answer skips the workaround and directly provides a solution for scikit-learn version 1.2+
From sklearn version 1.2 on, transformers can return a pandas DataFrame directly without further handling. It is done with set_output, which can be configured per estimator by calling the set_output method or globally by setting set_config(transform_output="pandas"). See Release Highlights for scikit-learn 1.2 - Pandas output with set_output API
In your case the solution would be:
ord_features = ["salary"]
ordinal_transformer = OrdinalEncoder()
cat_features = ["department"]
categorical_transformer = OneHotEncoder(handle_unknown="ignore")
ct = ColumnTransformer(
transformers=[
("ord", ordinal_transformer, ord_features),
("cat", categorical_transformer, cat_features ),
]
)
# Add the following line to your code
ct.set_output(transform="pandas")
df_new = ct.fit_transform(df)
df_new
Here is a solution by adding a transformer which will apply the inverse column permutation after the column transform:
from sklearn.base import BaseEstimator, TransformerMixin
import re
class ReorderColumnTransformer(BaseEstimator, TransformerMixin):
index_pattern = re.compile(r'\d+$')
def __init__(self, column_transformer):
self.column_transformer = column_transformer
def fit(self, X, y=None):
return self
def transform(self, X, y=None):
order_after_column_transform = [int( self.index_pattern.search(col).group()) for col in self.column_transformer.get_feature_names_out()]
order_inverse = np.zeros(len(order_after_column_transform), dtype=int)
order_inverse[order_after_column_transform] = np.arange(len(order_after_column_transform))
return X[:, order_inverse]
It relies on parsing
column_trans.get_feature_names_out()
# = array(['scaler__x1', 'scaler__x3', 'remainder__x0', 'remainder__x2'],
# dtype=object)
to read the initial column order from the suffix number. Then computing and applying the inverse permutation.
To be used as:
import numpy as np
from sklearn.compose import ColumnTransformer
from sklearn.preprocessing import MinMaxScaler
from sklearn.pipeline import make_pipeline
X = np.array ( [(25, 1, 2, 0),
(30, 1, 5, 0),
(25, 10, 2, 1),
(25, 1, 2, 0),
(np.nan, 10, 4, 1),
(40, 1, 2, 1) ] )
column_trans = ColumnTransformer(
[ ('scaler', MinMaxScaler(), [0,2]) ],
remainder='passthrough')
pipeline = make_pipeline( column_trans, ReorderColumnTransformer(column_transformer=column_trans))
X_scaled = pipeline.fit_transform(X)
#X_scaled has same column order as X
Alternative solution not relying on string parsing but reading the column slices of the column transformer:
from sklearn.base import BaseEstimator, TransformerMixin
class ReorderColumnTransformer(BaseEstimator, TransformerMixin):
def __init__(self, column_transformer):
self.column_transformer = column_transformer
def fit(self, X, y=None):
return self
def transform(self, X, y=None):
slices = self.column_transformer.output_indices_.values()
n_cols = self.column_transformer.n_features_in_
order_after_column_transform = [value for slice_ in slices for value in range(n_cols)[slice_]]
order_inverse = np.zeros(n_cols, dtype=int)
order_inverse[order_after_column_transform] = np.arange(n_cols)
return X[:, order_inverse]
ColumnTransformer can be used to reorder columns however you would like by passing it the column indices in the desired order. Pairing ColumnTransformer with an identity FunctionTransformer will make it do nothing but reorder the columns. (You can create an identity FunctionTransformer by not assigning func when initializing FunctionTransformer, in which case the data will passed through without being transformed).
import numpy as np
from sklearn.compose import make_column_transformer
from sklearn.preprocessing import FunctionTransformer
X = np.array ( [[30, 20, 10]] )
new_column_order = [2, 1, 0]
column_reorder_transformer = make_column_transformer((FunctionTransformer(), new_column_order))
Xt = column_reorder_transformer.fit_transform(X)
print(f"Xt = {Xt}")
# arr = [[10 20 30]]
TL;DR: for your use case, jump to the last section
One ColumnTransformer, many Pipelines
This is what I was suggesting in the comments and I've advanced elsewhere on this site. We use a single ColumnTransformer, each of whose transformers is a Pipeline. There is one pipeline for each combination of preprocessing steps you would like to perform. This has the advantage of being able to specify columns by name for each transformer. Downsides include having lots of different copies of the scaler, so if you wanted to hyperparameter-tune something about a transformer you'd have to change it in many places; also, if you have a lot of different unique preprocessing step combinations, this would take a lot of code to specify, but there are some ways to partially mitigate that.
pipe_target_encode = Pipeline([
("te", TargetEncoder()),
("sc", StandardScaler()),
])
pipe_impute = Pipeline([
("imp", SimpleImputer()),
("sc", StandardScaler()),
])
ColumnTransformer([
("target_enc", pipe_target_encode, ["c1", "c2", "c3"]),
("impute", pipe_impute, ["c4"]),
("scale", StandardScaler(), ["c5", "c6", "c7", "c8"]),
("ohe", OneHotEncoder(), ["c9", "c10"]),
])
One Pipeline, many ColumnTransformers
This one will be more readily possible when dataframes-out is accomplished, but if you can keep track of column ordering it can be done now.
target_enc = ColumnTransformer(
[("target_enc", TargetEncoder(), [3])], # c4
remainder="passthrough",
)
impute = ColumnTransformer(
[("impute", SimpleImputer(), [1, 2, 3])], # c4 is now first; c1, c2, c3
remainder="passthrough",
)
scale = ColumnTransformer(
[("scale", StandardScaler(), [0, 1, 2, 3, 4, 5, 6, 7])], #c1-3 are first, then c4, then c5-8
remainder="passthrough",
)
ohe = ColumnTransformer(
[("ohe", OneHotEncoder(), [8, 9])],
remainder="passthrough",
)
pipe = Pipeline([
("target_enc", target_enc),
("impute", impute),
("scale", scale),
("ohe", ohe),
])
The columns will be output in order 8-dummies, 9-dummies, 1, 2, 3, 4, 5, 6, 7. You could move the steps around to try to get the columns into the better order, but since OHE will produce an apriori-unknown number of columns, it might be tough to get the column indices right.
Hybrid
The best for this particular case, it's the cleanest and most semantically correct.
Because your transformers operate in a hierarchical way, we can get away with all column specifications being strings; if we had to specify things in a ColumnTransformer after any sklearn step, we'd have input arrays and would have to resort to index specification as above (again, until pandas-out is a thing).
step1 = ColumnTransformer(
[
("target_enc", TargetEncoder(), ["c1", "c2", "c3"]),
("impute", SimpleImputer(), ["c4"]),
],
remainder="passthrough",
)
num_pipe = Pipeline([
("prep", step1),
("scale", StandardScaler())
])
preproc = ColumnTransformer([
("num", num_pipe, ["c1", "c2", "c3", "c4", "c5", "c6", "c7", "c8"]),
("ohe", OneHotEncoder(), ["c9", "c10"]),
])
Run this snippet for the Hybrid approach's diagram, and see the overflow answer for diagrams of the other two approaches.
<style>#sk-5d6832b8-0986-4e65-92ae-040d8a1ce75c {color: black;background-color: white;}#sk-5d6832b8-0986-4e65-92ae-040d8a1ce75c pre{padding: 0;}#sk-5d6832b8-0986-4e65-92ae-040d8a1ce75c div.sk-toggleable {background-color: white;}#sk-5d6832b8-0986-4e65-92ae-040d8a1ce75c label.sk-toggleable__label {cursor: pointer;display: block;width: 100%;margin-bottom: 0;padding: 0.3em;box-sizing: border-box;text-align: center;}#sk-5d6832b8-0986-4e65-92ae-040d8a1ce75c label.sk-toggleable__label-arrow:before {content: "▸";float: left;margin-right: 0.25em;color: #696969;}#sk-5d6832b8-0986-4e65-92ae-040d8a1ce75c label.sk-toggleable__label-arrow:hover:before {color: black;}#sk-5d6832b8-0986-4e65-92ae-040d8a1ce75c div.sk-estimator:hover label.sk-toggleable__label-arrow:before {color: black;}#sk-5d6832b8-0986-4e65-92ae-040d8a1ce75c div.sk-toggleable__content {max-height: 0;max-width: 0;overflow: hidden;text-align: left;background-color: #f0f8ff;}#sk-5d6832b8-0986-4e65-92ae-040d8a1ce75c div.sk-toggleable__content pre {margin: 0.2em;color: black;border-radius: 0.25em;background-color: #f0f8ff;}#sk-5d6832b8-0986-4e65-92ae-040d8a1ce75c input.sk-toggleable__control:checked~div.sk-toggleable__content {max-height: 200px;max-width: 100%;overflow: auto;}#sk-5d6832b8-0986-4e65-92ae-040d8a1ce75c input.sk-toggleable__control:checked~label.sk-toggleable__label-arrow:before {content: "▾";}#sk-5d6832b8-0986-4e65-92ae-040d8a1ce75c div.sk-estimator input.sk-toggleable__control:checked~label.sk-toggleable__label {background-color: #d4ebff;}#sk-5d6832b8-0986-4e65-92ae-040d8a1ce75c div.sk-label input.sk-toggleable__control:checked~label.sk-toggleable__label {background-color: #d4ebff;}#sk-5d6832b8-0986-4e65-92ae-040d8a1ce75c input.sk-hidden--visually {border: 0;clip: rect(1px 1px 1px 1px);clip: rect(1px, 1px, 1px, 1px);height: 1px;margin: -1px;overflow: hidden;padding: 0;position: absolute;width: 1px;}#sk-5d6832b8-0986-4e65-92ae-040d8a1ce75c div.sk-estimator {font-family: monospace;background-color: #f0f8ff;border: 1px dotted black;border-radius: 0.25em;box-sizing: border-box;margin-bottom: 0.5em;}#sk-5d6832b8-0986-4e65-92ae-040d8a1ce75c div.sk-estimator:hover {background-color: #d4ebff;}#sk-5d6832b8-0986-4e65-92ae-040d8a1ce75c div.sk-parallel-item::after {content: "";width: 100%;border-bottom: 1px solid gray;flex-grow: 1;}#sk-5d6832b8-0986-4e65-92ae-040d8a1ce75c div.sk-label:hover label.sk-toggleable__label {background-color: #d4ebff;}#sk-5d6832b8-0986-4e65-92ae-040d8a1ce75c div.sk-serial::before {content: "";position: absolute;border-left: 1px solid gray;box-sizing: border-box;top: 2em;bottom: 0;left: 50%;}#sk-5d6832b8-0986-4e65-92ae-040d8a1ce75c div.sk-serial {display: flex;flex-direction: column;align-items: center;background-color: white;padding-right: 0.2em;padding-left: 0.2em;}#sk-5d6832b8-0986-4e65-92ae-040d8a1ce75c div.sk-item {z-index: 1;}#sk-5d6832b8-0986-4e65-92ae-040d8a1ce75c div.sk-parallel {display: flex;align-items: stretch;justify-content: center;background-color: white;}#sk-5d6832b8-0986-4e65-92ae-040d8a1ce75c div.sk-parallel::before {content: "";position: absolute;border-left: 1px solid gray;box-sizing: border-box;top: 2em;bottom: 0;left: 50%;}#sk-5d6832b8-0986-4e65-92ae-040d8a1ce75c div.sk-parallel-item {display: flex;flex-direction: column;position: relative;background-color: white;}#sk-5d6832b8-0986-4e65-92ae-040d8a1ce75c div.sk-parallel-item:first-child::after {align-self: flex-end;width: 50%;}#sk-5d6832b8-0986-4e65-92ae-040d8a1ce75c div.sk-parallel-item:last-child::after {align-self: flex-start;width: 50%;}#sk-5d6832b8-0986-4e65-92ae-040d8a1ce75c div.sk-parallel-item:only-child::after {width: 0;}#sk-5d6832b8-0986-4e65-92ae-040d8a1ce75c div.sk-dashed-wrapped {border: 1px dashed gray;margin: 0 0.4em 0.5em 0.4em;box-sizing: border-box;padding-bottom: 0.4em;background-color: white;position: relative;}#sk-5d6832b8-0986-4e65-92ae-040d8a1ce75c div.sk-label label {font-family: monospace;font-weight: bold;background-color: white;display: inline-block;line-height: 1.2em;}#sk-5d6832b8-0986-4e65-92ae-040d8a1ce75c div.sk-label-container {position: relative;z-index: 2;text-align: center;}#sk-5d6832b8-0986-4e65-92ae-040d8a1ce75c div.sk-container {/* jupyter's `normalize.less` sets `[hidden] { display: none; }` but bootstrap.min.css set `[hidden] { display: none !important; }` so we also need the `!important` here to be able to override the default hidden behavior on the sphinx rendered scikit-learn.org. See: https://github.com/scikit-learn/scikit-learn/issues/21755 */display: inline-block !important;position: relative;}#sk-5d6832b8-0986-4e65-92ae-040d8a1ce75c div.sk-text-repr-fallback {display: none;}</style>
<div id="sk-5d6832b8-0986-4e65-92ae-040d8a1ce75c" class="sk-top-container"><div class="sk-text-repr-fallback"><pre>ColumnTransformer(transformers=[('num',
Pipeline(steps=[('prep',
ColumnTransformer(remainder='passthrough',
transformers=[('target_enc',
TargetEncoder(),
['c1',
'c2',
'c3']),
('impute',
SimpleImputer(),
['c4'])])),
('scale', StandardScaler())]),
['c1', 'c2', 'c3', 'c4', 'c5', 'c6', 'c7',
'c8']),
('ohe', OneHotEncoder(), ['c9', 'c10'])])</pre><b>Please rerun this cell to show the HTML repr or trust the notebook.</b></div><div class="sk-container" hidden><div class="sk-item sk-dashed-wrapped"><div class="sk-label-container"><div class="sk-label sk-toggleable"><input class="sk-toggleable__control sk-hidden--visually" id="8b1cfddf-93ac-47a5-8d5f-46f4b91f1dbd" type="checkbox" ><label for="8b1cfddf-93ac-47a5-8d5f-46f4b91f1dbd" class="sk-toggleable__label sk-toggleable__label-arrow">ColumnTransformer</label><div class="sk-toggleable__content"><pre>ColumnTransformer(transformers=[('num',
Pipeline(steps=[('prep',
ColumnTransformer(remainder='passthrough',
transformers=[('target_enc',
TargetEncoder(),
['c1',
'c2',
'c3']),
('impute',
SimpleImputer(),
['c4'])])),
('scale', StandardScaler())]),
['c1', 'c2', 'c3', 'c4', 'c5', 'c6', 'c7',
'c8']),
('ohe', OneHotEncoder(), ['c9', 'c10'])])</pre></div></div></div><div class="sk-parallel"><div class="sk-parallel-item"><div class="sk-item"><div class="sk-label-container"><div class="sk-label sk-toggleable"><input class="sk-toggleable__control sk-hidden--visually" id="b42df77f-364c-47b4-81dc-2591b43c0201" type="checkbox" checked ><label for="b42df77f-364c-47b4-81dc-2591b43c0201" class="sk-toggleable__label sk-toggleable__label-arrow">num</label><div class="sk-toggleable__content"><pre>['c1', 'c2', 'c3', 'c4', 'c5', 'c6', 'c7', 'c8']</pre></div></div></div><div class="sk-serial"><div class="sk-item"><div class="sk-serial"><div class="sk-item sk-dashed-wrapped"><div class="sk-label-container"><div class="sk-label sk-toggleable"><input class="sk-toggleable__control sk-hidden--visually" id="27c515f2-9c65-498d-ad8b-1e7942530ec9" type="checkbox" ><label for="27c515f2-9c65-498d-ad8b-1e7942530ec9" class="sk-toggleable__label sk-toggleable__label-arrow">prep: ColumnTransformer</label><div class="sk-toggleable__content"><pre>ColumnTransformer(remainder='passthrough',
transformers=[('target_enc', TargetEncoder(),
['c1', 'c2', 'c3']),
('impute', SimpleImputer(), ['c4'])])</pre></div></div></div><div class="sk-parallel"><div class="sk-parallel-item"><div class="sk-item"><div class="sk-label-container"><div class="sk-label sk-toggleable"><input class="sk-toggleable__control sk-hidden--visually" id="7d4f168c-5ce5-484d-bb05-ba4986ba97d5" type="checkbox" checked ><label for="7d4f168c-5ce5-484d-bb05-ba4986ba97d5" class="sk-toggleable__label sk-toggleable__label-arrow">target_enc</label><div class="sk-toggleable__content"><pre>['c1', 'c2', 'c3']</pre></div></div></div><div class="sk-serial"><div class="sk-item"><div class="sk-estimator sk-toggleable"><input class="sk-toggleable__control sk-hidden--visually" id="f645cf10-e9b2-49d8-8822-a37d9c67b337" type="checkbox" ><label for="f645cf10-e9b2-49d8-8822-a37d9c67b337" class="sk-toggleable__label sk-toggleable__label-arrow">TargetEncoder</label><div class="sk-toggleable__content"><pre>TargetEncoder()</pre></div></div></div></div></div></div><div class="sk-parallel-item"><div class="sk-item"><div class="sk-label-container"><div class="sk-label sk-toggleable"><input class="sk-toggleable__control sk-hidden--visually" id="aac2d6a2-5b8c-4907-8bc9-4a6d99244755" type="checkbox" checked ><label for="aac2d6a2-5b8c-4907-8bc9-4a6d99244755" class="sk-toggleable__label sk-toggleable__label-arrow">impute</label><div class="sk-toggleable__content"><pre>['c4']</pre></div></div></div><div class="sk-serial"><div class="sk-item"><div class="sk-estimator sk-toggleable"><input class="sk-toggleable__control sk-hidden--visually" id="e085f2bd-c170-490d-a432-685977ff2741" type="checkbox" ><label for="e085f2bd-c170-490d-a432-685977ff2741" class="sk-toggleable__label sk-toggleable__label-arrow">SimpleImputer</label><div class="sk-toggleable__content"><pre>SimpleImputer()</pre></div></div></div></div></div></div><div class="sk-parallel-item"><div class="sk-item"><div class="sk-label-container"><div class="sk-label sk-toggleable"><input class="sk-toggleable__control sk-hidden--visually" id="c9b092a5-aa9f-46e1-a7e3-5c97c4d6001e" type="checkbox" ><label for="c9b092a5-aa9f-46e1-a7e3-5c97c4d6001e" class="sk-toggleable__label sk-toggleable__label-arrow">remainder</label><div class="sk-toggleable__content"><pre></pre></div></div></div><div class="sk-serial"><div class="sk-item"><div class="sk-estimator sk-toggleable"><input class="sk-toggleable__control sk-hidden--visually" id="b89a30e1-bcd2-4677-8071-99e6857ffb5f" type="checkbox" ><label for="b89a30e1-bcd2-4677-8071-99e6857ffb5f" class="sk-toggleable__label sk-toggleable__label-arrow">passthrough</label><div class="sk-toggleable__content"><pre>passthrough</pre></div></div></div></div></div></div></div></div><div class="sk-item"><div class="sk-estimator sk-toggleable"><input class="sk-toggleable__control sk-hidden--visually" id="591ec259-41a7-403e-bc5d-4f45fa612895" type="checkbox" ><label for="591ec259-41a7-403e-bc5d-4f45fa612895" class="sk-toggleable__label sk-toggleable__label-arrow">StandardScaler</label><div class="sk-toggleable__content"><pre>StandardScaler()</pre></div></div></div></div></div></div></div></div><div class="sk-parallel-item"><div class="sk-item"><div class="sk-label-container"><div class="sk-label sk-toggleable"><input class="sk-toggleable__control sk-hidden--visually" id="410b46ee-6c96-4ddd-84bc-73577e0c2538" type="checkbox" checked ><label for="410b46ee-6c96-4ddd-84bc-73577e0c2538" class="sk-toggleable__label sk-toggleable__label-arrow">ohe</label><div class="sk-toggleable__content"><pre>['c9', 'c10']</pre></div></div></div><div class="sk-serial"><div class="sk-item"><div class="sk-estimator sk-toggleable"><input class="sk-toggleable__control sk-hidden--visually" id="5c4492e0-ba44-446b-a82d-36caa3f1cccb" type="checkbox" ><label for="5c4492e0-ba44-446b-a82d-36caa3f1cccb" class="sk-toggleable__label sk-toggleable__label-arrow">OneHotEncoder</label><div class="sk-toggleable__content"><pre>OneHotEncoder()</pre></div></div></div></div></div></div></div></div></div></div>
diagrams of the other two approaches; including them made the main answer too long (don't upvote!!!)
One-CT:
<style>#sk-f2196474-2b94-440b-a0e4-8a58641f5c1c {color: black;background-color: white;}#sk-f2196474-2b94-440b-a0e4-8a58641f5c1c pre{padding: 0;}#sk-f2196474-2b94-440b-a0e4-8a58641f5c1c div.sk-toggleable {background-color: white;}#sk-f2196474-2b94-440b-a0e4-8a58641f5c1c label.sk-toggleable__label {cursor: pointer;display: block;width: 100%;margin-bottom: 0;padding: 0.3em;box-sizing: border-box;text-align: center;}#sk-f2196474-2b94-440b-a0e4-8a58641f5c1c label.sk-toggleable__label-arrow:before {content: "▸";float: left;margin-right: 0.25em;color: #696969;}#sk-f2196474-2b94-440b-a0e4-8a58641f5c1c label.sk-toggleable__label-arrow:hover:before {color: black;}#sk-f2196474-2b94-440b-a0e4-8a58641f5c1c div.sk-estimator:hover label.sk-toggleable__label-arrow:before {color: black;}#sk-f2196474-2b94-440b-a0e4-8a58641f5c1c div.sk-toggleable__content {max-height: 0;max-width: 0;overflow: hidden;text-align: left;background-color: #f0f8ff;}#sk-f2196474-2b94-440b-a0e4-8a58641f5c1c div.sk-toggleable__content pre {margin: 0.2em;color: black;border-radius: 0.25em;background-color: #f0f8ff;}#sk-f2196474-2b94-440b-a0e4-8a58641f5c1c input.sk-toggleable__control:checked~div.sk-toggleable__content {max-height: 200px;max-width: 100%;overflow: auto;}#sk-f2196474-2b94-440b-a0e4-8a58641f5c1c input.sk-toggleable__control:checked~label.sk-toggleable__label-arrow:before {content: "▾";}#sk-f2196474-2b94-440b-a0e4-8a58641f5c1c div.sk-estimator input.sk-toggleable__control:checked~label.sk-toggleable__label {background-color: #d4ebff;}#sk-f2196474-2b94-440b-a0e4-8a58641f5c1c div.sk-label input.sk-toggleable__control:checked~label.sk-toggleable__label {background-color: #d4ebff;}#sk-f2196474-2b94-440b-a0e4-8a58641f5c1c input.sk-hidden--visually {border: 0;clip: rect(1px 1px 1px 1px);clip: rect(1px, 1px, 1px, 1px);height: 1px;margin: -1px;overflow: hidden;padding: 0;position: absolute;width: 1px;}#sk-f2196474-2b94-440b-a0e4-8a58641f5c1c div.sk-estimator {font-family: monospace;background-color: #f0f8ff;border: 1px dotted black;border-radius: 0.25em;box-sizing: border-box;margin-bottom: 0.5em;}#sk-f2196474-2b94-440b-a0e4-8a58641f5c1c div.sk-estimator:hover {background-color: #d4ebff;}#sk-f2196474-2b94-440b-a0e4-8a58641f5c1c div.sk-parallel-item::after {content: "";width: 100%;border-bottom: 1px solid gray;flex-grow: 1;}#sk-f2196474-2b94-440b-a0e4-8a58641f5c1c div.sk-label:hover label.sk-toggleable__label {background-color: #d4ebff;}#sk-f2196474-2b94-440b-a0e4-8a58641f5c1c div.sk-serial::before {content: "";position: absolute;border-left: 1px solid gray;box-sizing: border-box;top: 2em;bottom: 0;left: 50%;}#sk-f2196474-2b94-440b-a0e4-8a58641f5c1c div.sk-serial {display: flex;flex-direction: column;align-items: center;background-color: white;padding-right: 0.2em;padding-left: 0.2em;}#sk-f2196474-2b94-440b-a0e4-8a58641f5c1c div.sk-item {z-index: 1;}#sk-f2196474-2b94-440b-a0e4-8a58641f5c1c div.sk-parallel {display: flex;align-items: stretch;justify-content: center;background-color: white;}#sk-f2196474-2b94-440b-a0e4-8a58641f5c1c div.sk-parallel::before {content: "";position: absolute;border-left: 1px solid gray;box-sizing: border-box;top: 2em;bottom: 0;left: 50%;}#sk-f2196474-2b94-440b-a0e4-8a58641f5c1c div.sk-parallel-item {display: flex;flex-direction: column;position: relative;background-color: white;}#sk-f2196474-2b94-440b-a0e4-8a58641f5c1c div.sk-parallel-item:first-child::after {align-self: flex-end;width: 50%;}#sk-f2196474-2b94-440b-a0e4-8a58641f5c1c div.sk-parallel-item:last-child::after {align-self: flex-start;width: 50%;}#sk-f2196474-2b94-440b-a0e4-8a58641f5c1c div.sk-parallel-item:only-child::after {width: 0;}#sk-f2196474-2b94-440b-a0e4-8a58641f5c1c div.sk-dashed-wrapped {border: 1px dashed gray;margin: 0 0.4em 0.5em 0.4em;box-sizing: border-box;padding-bottom: 0.4em;background-color: white;position: relative;}#sk-f2196474-2b94-440b-a0e4-8a58641f5c1c div.sk-label label {font-family: monospace;font-weight: bold;background-color: white;display: inline-block;line-height: 1.2em;}#sk-f2196474-2b94-440b-a0e4-8a58641f5c1c div.sk-label-container {position: relative;z-index: 2;text-align: center;}#sk-f2196474-2b94-440b-a0e4-8a58641f5c1c div.sk-container {/* jupyter's `normalize.less` sets `[hidden] { display: none; }` but bootstrap.min.css set `[hidden] { display: none !important; }` so we also need the `!important` here to be able to override the default hidden behavior on the sphinx rendered scikit-learn.org. See: https://github.com/scikit-learn/scikit-learn/issues/21755 */display: inline-block !important;position: relative;}#sk-f2196474-2b94-440b-a0e4-8a58641f5c1c div.sk-text-repr-fallback {display: none;}</style>
<div id="sk-f2196474-2b94-440b-a0e4-8a58641f5c1c" class="sk-top-container"><div class="sk-text-repr-fallback"><pre>ColumnTransformer(transformers=[('target_enc',
Pipeline(steps=[('te', TargetEncoder()),
('sc', StandardScaler())]),
['c1', 'c2', 'c3']),
('impute',
Pipeline(steps=[('imp', SimpleImputer()),
('sc', StandardScaler())]),
['c4']),
('scale', StandardScaler(),
['c5', 'c6', 'c7', 'c8']),
('ohe', OneHotEncoder(), ['c9', 'c10'])])</pre></div><div class="sk-container" hidden><div class="sk-item sk-dashed-wrapped"><div class="sk-label-container"><div class="sk-label sk-toggleable"><input class="sk-toggleable__control sk-hidden--visually" id="5c66e59e-6733-434f-a958-0d47b122de49" type="checkbox" ><label for="5c66e59e-6733-434f-a958-0d47b122de49" class="sk-toggleable__label sk-toggleable__label-arrow">ColumnTransformer</label><div class="sk-toggleable__content"><pre>ColumnTransformer(transformers=[('target_enc',
Pipeline(steps=[('te', TargetEncoder()),
('sc', StandardScaler())]),
['c1', 'c2', 'c3']),
('impute',
Pipeline(steps=[('imp', SimpleImputer()),
('sc', StandardScaler())]),
['c4']),
('scale', StandardScaler(),
['c5', 'c6', 'c7', 'c8']),
('ohe', OneHotEncoder(), ['c9', 'c10'])])</pre></div></div></div><div class="sk-parallel"><div class="sk-parallel-item"><div class="sk-item"><div class="sk-label-container"><div class="sk-label sk-toggleable"><input class="sk-toggleable__control sk-hidden--visually" id="6450180d-933f-4a27-ac8e-386be31a20cd" type="checkbox" checked ><label for="6450180d-933f-4a27-ac8e-386be31a20cd" class="sk-toggleable__label sk-toggleable__label-arrow">target_enc</label><div class="sk-toggleable__content"><pre>['c1', 'c2', 'c3']</pre></div></div></div><div class="sk-serial"><div class="sk-item"><div class="sk-serial"><div class="sk-item"><div class="sk-estimator sk-toggleable"><input class="sk-toggleable__control sk-hidden--visually" id="a7af0193-5262-49d3-8bed-147e9e16b24e" type="checkbox" ><label for="a7af0193-5262-49d3-8bed-147e9e16b24e" class="sk-toggleable__label sk-toggleable__label-arrow">TargetEncoder</label><div class="sk-toggleable__content"><pre>TargetEncoder()</pre></div></div></div><div class="sk-item"><div class="sk-estimator sk-toggleable"><input class="sk-toggleable__control sk-hidden--visually" id="7864972f-3048-465f-8061-7d223cec014a" type="checkbox" ><label for="7864972f-3048-465f-8061-7d223cec014a" class="sk-toggleable__label sk-toggleable__label-arrow">StandardScaler</label><div class="sk-toggleable__content"><pre>StandardScaler()</pre></div></div></div></div></div></div></div></div><div class="sk-parallel-item"><div class="sk-item"><div class="sk-label-container"><div class="sk-label sk-toggleable"><input class="sk-toggleable__control sk-hidden--visually" id="504bbeeb-bec2-4606-b2dc-ab9248dd1b8c" type="checkbox" checked><label for="504bbeeb-bec2-4606-b2dc-ab9248dd1b8c" class="sk-toggleable__label sk-toggleable__label-arrow">impute</label><div class="sk-toggleable__content"><pre>['c4']</pre></div></div></div><div class="sk-serial"><div class="sk-item"><div class="sk-serial"><div class="sk-item"><div class="sk-estimator sk-toggleable"><input class="sk-toggleable__control sk-hidden--visually" id="3a78a6b3-d021-472c-af14-baa968c7790f" type="checkbox" ><label for="3a78a6b3-d021-472c-af14-baa968c7790f" class="sk-toggleable__label sk-toggleable__label-arrow">SimpleImputer</label><div class="sk-toggleable__content"><pre>SimpleImputer()</pre></div></div></div><div class="sk-item"><div class="sk-estimator sk-toggleable"><input class="sk-toggleable__control sk-hidden--visually" id="4804b7a2-b134-4fb9-8a8d-5867c6748f8c" type="checkbox" ><label for="4804b7a2-b134-4fb9-8a8d-5867c6748f8c" class="sk-toggleable__label sk-toggleable__label-arrow">StandardScaler</label><div class="sk-toggleable__content"><pre>StandardScaler()</pre></div></div></div></div></div></div></div></div><div class="sk-parallel-item"><div class="sk-item"><div class="sk-label-container"><div class="sk-label sk-toggleable"><input class="sk-toggleable__control sk-hidden--visually" id="578d2847-6c63-402e-836c-1f5ffc7b62ec" type="checkbox" checked><label for="578d2847-6c63-402e-836c-1f5ffc7b62ec" class="sk-toggleable__label sk-toggleable__label-arrow">scale</label><div class="sk-toggleable__content"><pre>['c5', 'c6', 'c7', 'c8']</pre></div></div></div><div class="sk-serial"><div class="sk-item"><div class="sk-estimator sk-toggleable"><input class="sk-toggleable__control sk-hidden--visually" id="e4f0d0c1-192d-4e5d-9d25-6409c59d8836" type="checkbox" ><label for="e4f0d0c1-192d-4e5d-9d25-6409c59d8836" class="sk-toggleable__label sk-toggleable__label-arrow">StandardScaler</label><div class="sk-toggleable__content"><pre>StandardScaler()</pre></div></div></div></div></div></div><div class="sk-parallel-item"><div class="sk-item"><div class="sk-label-container"><div class="sk-label sk-toggleable"><input class="sk-toggleable__control sk-hidden--visually" id="ddba4409-5b82-4102-86cc-64091d5f0bef" type="checkbox" checked ><label for="ddba4409-5b82-4102-86cc-64091d5f0bef" class="sk-toggleable__label sk-toggleable__label-arrow">ohe</label><div class="sk-toggleable__content"><pre>['c9', 'c10']</pre></div></div></div><div class="sk-serial"><div class="sk-item"><div class="sk-estimator sk-toggleable"><input class="sk-toggleable__control sk-hidden--visually" id="c58c238f-8ab1-462b-acb1-f972a9f20c93" type="checkbox" ><label for="c58c238f-8ab1-462b-acb1-f972a9f20c93" class="sk-toggleable__label sk-toggleable__label-arrow">OneHotEncoder</label><div class="sk-toggleable__content"><pre>OneHotEncoder()</pre></div></div></div></div></div></div></div></div></div></div>
One Pipeline:
<style>#sk-ced6b6e1-e96b-4741-ab14-62a08208d157 {color: black;background-color: white;}#sk-ced6b6e1-e96b-4741-ab14-62a08208d157 pre{padding: 0;}#sk-ced6b6e1-e96b-4741-ab14-62a08208d157 div.sk-toggleable {background-color: white;}#sk-ced6b6e1-e96b-4741-ab14-62a08208d157 label.sk-toggleable__label {cursor: pointer;display: block;width: 100%;margin-bottom: 0;padding: 0.3em;box-sizing: border-box;text-align: center;}#sk-ced6b6e1-e96b-4741-ab14-62a08208d157 label.sk-toggleable__label-arrow:before {content: "▸";float: left;margin-right: 0.25em;color: #696969;}#sk-ced6b6e1-e96b-4741-ab14-62a08208d157 label.sk-toggleable__label-arrow:hover:before {color: black;}#sk-ced6b6e1-e96b-4741-ab14-62a08208d157 div.sk-estimator:hover label.sk-toggleable__label-arrow:before {color: black;}#sk-ced6b6e1-e96b-4741-ab14-62a08208d157 div.sk-toggleable__content {max-height: 0;max-width: 0;overflow: hidden;text-align: left;background-color: #f0f8ff;}#sk-ced6b6e1-e96b-4741-ab14-62a08208d157 div.sk-toggleable__content pre {margin: 0.2em;color: black;border-radius: 0.25em;background-color: #f0f8ff;}#sk-ced6b6e1-e96b-4741-ab14-62a08208d157 input.sk-toggleable__control:checked~div.sk-toggleable__content {max-height: 200px;max-width: 100%;overflow: auto;}#sk-ced6b6e1-e96b-4741-ab14-62a08208d157 input.sk-toggleable__control:checked~label.sk-toggleable__label-arrow:before {content: "▾";}#sk-ced6b6e1-e96b-4741-ab14-62a08208d157 div.sk-estimator input.sk-toggleable__control:checked~label.sk-toggleable__label {background-color: #d4ebff;}#sk-ced6b6e1-e96b-4741-ab14-62a08208d157 div.sk-label input.sk-toggleable__control:checked~label.sk-toggleable__label {background-color: #d4ebff;}#sk-ced6b6e1-e96b-4741-ab14-62a08208d157 input.sk-hidden--visually {border: 0;clip: rect(1px 1px 1px 1px);clip: rect(1px, 1px, 1px, 1px);height: 1px;margin: -1px;overflow: hidden;padding: 0;position: absolute;width: 1px;}#sk-ced6b6e1-e96b-4741-ab14-62a08208d157 div.sk-estimator {font-family: monospace;background-color: #f0f8ff;border: 1px dotted black;border-radius: 0.25em;box-sizing: border-box;margin-bottom: 0.5em;}#sk-ced6b6e1-e96b-4741-ab14-62a08208d157 div.sk-estimator:hover {background-color: #d4ebff;}#sk-ced6b6e1-e96b-4741-ab14-62a08208d157 div.sk-parallel-item::after {content: "";width: 100%;border-bottom: 1px solid gray;flex-grow: 1;}#sk-ced6b6e1-e96b-4741-ab14-62a08208d157 div.sk-label:hover label.sk-toggleable__label {background-color: #d4ebff;}#sk-ced6b6e1-e96b-4741-ab14-62a08208d157 div.sk-serial::before {content: "";position: absolute;border-left: 1px solid gray;box-sizing: border-box;top: 2em;bottom: 0;left: 50%;}#sk-ced6b6e1-e96b-4741-ab14-62a08208d157 div.sk-serial {display: flex;flex-direction: column;align-items: center;background-color: white;padding-right: 0.2em;padding-left: 0.2em;}#sk-ced6b6e1-e96b-4741-ab14-62a08208d157 div.sk-item {z-index: 1;}#sk-ced6b6e1-e96b-4741-ab14-62a08208d157 div.sk-parallel {display: flex;align-items: stretch;justify-content: center;background-color: white;}#sk-ced6b6e1-e96b-4741-ab14-62a08208d157 div.sk-parallel::before {content: "";position: absolute;border-left: 1px solid gray;box-sizing: border-box;top: 2em;bottom: 0;left: 50%;}#sk-ced6b6e1-e96b-4741-ab14-62a08208d157 div.sk-parallel-item {display: flex;flex-direction: column;position: relative;background-color: white;}#sk-ced6b6e1-e96b-4741-ab14-62a08208d157 div.sk-parallel-item:first-child::after {align-self: flex-end;width: 50%;}#sk-ced6b6e1-e96b-4741-ab14-62a08208d157 div.sk-parallel-item:last-child::after {align-self: flex-start;width: 50%;}#sk-ced6b6e1-e96b-4741-ab14-62a08208d157 div.sk-parallel-item:only-child::after {width: 0;}#sk-ced6b6e1-e96b-4741-ab14-62a08208d157 div.sk-dashed-wrapped {border: 1px dashed gray;margin: 0 0.4em 0.5em 0.4em;box-sizing: border-box;padding-bottom: 0.4em;background-color: white;position: relative;}#sk-ced6b6e1-e96b-4741-ab14-62a08208d157 div.sk-label label {font-family: monospace;font-weight: bold;background-color: white;display: inline-block;line-height: 1.2em;}#sk-ced6b6e1-e96b-4741-ab14-62a08208d157 div.sk-label-container {position: relative;z-index: 2;text-align: center;}#sk-ced6b6e1-e96b-4741-ab14-62a08208d157 div.sk-container {/* jupyter's `normalize.less` sets `[hidden] { display: none; }` but bootstrap.min.css set `[hidden] { display: none !important; }` so we also need the `!important` here to be able to override the default hidden behavior on the sphinx rendered scikit-learn.org. See: https://github.com/scikit-learn/scikit-learn/issues/21755 */display: inline-block !important;position: relative;}#sk-ced6b6e1-e96b-4741-ab14-62a08208d157 div.sk-text-repr-fallback {display: none;}</style>
<div id="sk-ced6b6e1-e96b-4741-ab14-62a08208d157" class="sk-top-container"><div class="sk-text-repr-fallback"><pre>Pipeline(steps=[('target_enc',
ColumnTransformer(remainder='passthrough',
transformers=[('target_enc', TargetEncoder(),
[3])])),
('impute',
ColumnTransformer(remainder='passthrough',
transformers=[('impute', SimpleImputer(),
[1, 2, 3])])),
('scale',
ColumnTransformer(remainder='passthrough',
transformers=[('scale', StandardScaler(),
[0, 1, 2, 3, 4, 5, 6, 7])])),
('ohe',
ColumnTransformer(remainder='passthrough',
transformers=[('ohe', OneHotEncoder(),
[8, 9])]))])</pre><b>Please rerun this cell to show the HTML repr or trust the notebook.</b></div><div class="sk-container" hidden><div class="sk-item sk-dashed-wrapped"><div class="sk-label-container"><div class="sk-label sk-toggleable"><input class="sk-toggleable__control sk-hidden--visually" id="a320204f-f77e-4b4b-94f2-9ac588617232" type="checkbox" ><label for="a320204f-f77e-4b4b-94f2-9ac588617232" class="sk-toggleable__label sk-toggleable__label-arrow">Pipeline</label><div class="sk-toggleable__content"><pre>Pipeline(steps=[('target_enc',
ColumnTransformer(remainder='passthrough',
transformers=[('target_enc', TargetEncoder(),
[3])])),
('impute',
ColumnTransformer(remainder='passthrough',
transformers=[('impute', SimpleImputer(),
[1, 2, 3])])),
('scale',
ColumnTransformer(remainder='passthrough',
transformers=[('scale', StandardScaler(),
[0, 1, 2, 3, 4, 5, 6, 7])])),
('ohe',
ColumnTransformer(remainder='passthrough',
transformers=[('ohe', OneHotEncoder(),
[8, 9])]))])</pre></div></div></div><div class="sk-serial"><div class="sk-item sk-dashed-wrapped"><div class="sk-label-container"><div class="sk-label sk-toggleable"><input class="sk-toggleable__control sk-hidden--visually" id="59c766af-6da9-43a9-bc67-11b61fa0053e" type="checkbox"><label for="59c766af-6da9-43a9-bc67-11b61fa0053e" class="sk-toggleable__label sk-toggleable__label-arrow">target_enc: ColumnTransformer</label><div class="sk-toggleable__content"><pre>ColumnTransformer(remainder='passthrough',
transformers=[('target_enc', TargetEncoder(), [3])])</pre></div></div></div><div class="sk-parallel"><div class="sk-parallel-item"><div class="sk-item"><div class="sk-label-container"><div class="sk-label sk-toggleable"><input class="sk-toggleable__control sk-hidden--visually" id="9aa47181-e273-4438-b52d-1f73f17c3631" type="checkbox" checked><label for="9aa47181-e273-4438-b52d-1f73f17c3631" class="sk-toggleable__label sk-toggleable__label-arrow">target_enc</label><div class="sk-toggleable__content"><pre>[3]</pre></div></div></div><div class="sk-serial"><div class="sk-item"><div class="sk-estimator sk-toggleable"><input class="sk-toggleable__control sk-hidden--visually" id="0c01315d-281f-473b-89ab-a9dd2ae92de6" type="checkbox" ><label for="0c01315d-281f-473b-89ab-a9dd2ae92de6" class="sk-toggleable__label sk-toggleable__label-arrow">TargetEncoder</label><div class="sk-toggleable__content"><pre>TargetEncoder()</pre></div></div></div></div></div></div><div class="sk-parallel-item"><div class="sk-item"><div class="sk-label-container"><div class="sk-label sk-toggleable"><input class="sk-toggleable__control sk-hidden--visually" id="05d4f3b3-a06a-432d-a0eb-fa4fce393acc" type="checkbox" ><label for="05d4f3b3-a06a-432d-a0eb-fa4fce393acc" class="sk-toggleable__label sk-toggleable__label-arrow">remainder</label><div class="sk-toggleable__content"><pre></pre></div></div></div><div class="sk-serial"><div class="sk-item"><div class="sk-estimator sk-toggleable"><input class="sk-toggleable__control sk-hidden--visually" id="949c9196-8d6f-4ab7-bcc3-1bd80b4a4504" type="checkbox" ><label for="949c9196-8d6f-4ab7-bcc3-1bd80b4a4504" class="sk-toggleable__label sk-toggleable__label-arrow">passthrough</label><div class="sk-toggleable__content"><pre>passthrough</pre></div></div></div></div></div></div></div></div><div class="sk-item sk-dashed-wrapped"><div class="sk-label-container"><div class="sk-label sk-toggleable"><input class="sk-toggleable__control sk-hidden--visually" id="9b01bc09-48f8-49c8-b358-2f40440d8d2a" type="checkbox" ><label for="9b01bc09-48f8-49c8-b358-2f40440d8d2a" class="sk-toggleable__label sk-toggleable__label-arrow">impute: ColumnTransformer</label><div class="sk-toggleable__content"><pre>ColumnTransformer(remainder='passthrough',
transformers=[('impute', SimpleImputer(), [1, 2, 3])])</pre></div></div></div><div class="sk-parallel"><div class="sk-parallel-item"><div class="sk-item"><div class="sk-label-container"><div class="sk-label sk-toggleable"><input class="sk-toggleable__control sk-hidden--visually" id="1346daa4-bdaa-43e8-9fb7-94ab3f7a77e3" type="checkbox" checked ><label for="1346daa4-bdaa-43e8-9fb7-94ab3f7a77e3" class="sk-toggleable__label sk-toggleable__label-arrow">impute</label><div class="sk-toggleable__content"><pre>[1, 2, 3]</pre></div></div></div><div class="sk-serial"><div class="sk-item"><div class="sk-estimator sk-toggleable"><input class="sk-toggleable__control sk-hidden--visually" id="2dba1089-b7bc-4ee4-ba38-c32763f59d50" type="checkbox" ><label for="2dba1089-b7bc-4ee4-ba38-c32763f59d50" class="sk-toggleable__label sk-toggleable__label-arrow">SimpleImputer</label><div class="sk-toggleable__content"><pre>SimpleImputer()</pre></div></div></div></div></div></div><div class="sk-parallel-item"><div class="sk-item"><div class="sk-label-container"><div class="sk-label sk-toggleable"><input class="sk-toggleable__control sk-hidden--visually" id="1a8bb098-c884-4442-b74e-033446b9f4cf" type="checkbox" ><label for="1a8bb098-c884-4442-b74e-033446b9f4cf" class="sk-toggleable__label sk-toggleable__label-arrow">remainder</label><div class="sk-toggleable__content"><pre></pre></div></div></div><div class="sk-serial"><div class="sk-item"><div class="sk-estimator sk-toggleable"><input class="sk-toggleable__control sk-hidden--visually" id="5a27f77c-7e94-442d-9340-fd8dd912a7db" type="checkbox" ><label for="5a27f77c-7e94-442d-9340-fd8dd912a7db" class="sk-toggleable__label sk-toggleable__label-arrow">passthrough</label><div class="sk-toggleable__content"><pre>passthrough</pre></div></div></div></div></div></div></div></div><div class="sk-item sk-dashed-wrapped"><div class="sk-label-container"><div class="sk-label sk-toggleable"><input class="sk-toggleable__control sk-hidden--visually" id="618a09c4-5356-4e78-9020-03ced5e4f29a" type="checkbox" ><label for="618a09c4-5356-4e78-9020-03ced5e4f29a" class="sk-toggleable__label sk-toggleable__label-arrow">scale: ColumnTransformer</label><div class="sk-toggleable__content"><pre>ColumnTransformer(remainder='passthrough',
transformers=[('scale', StandardScaler(),
[0, 1, 2, 3, 4, 5, 6, 7])])</pre></div></div></div><div class="sk-parallel"><div class="sk-parallel-item"><div class="sk-item"><div class="sk-label-container"><div class="sk-label sk-toggleable"><input class="sk-toggleable__control sk-hidden--visually" id="1527c9af-9be6-4387-8b7b-98aaa9ac884c" type="checkbox" checked ><label for="1527c9af-9be6-4387-8b7b-98aaa9ac884c" class="sk-toggleable__label sk-toggleable__label-arrow">scale</label><div class="sk-toggleable__content"><pre>[0, 1, 2, 3, 4, 5, 6, 7]</pre></div></div></div><div class="sk-serial"><div class="sk-item"><div class="sk-estimator sk-toggleable"><input class="sk-toggleable__control sk-hidden--visually" id="79361708-dafe-43f3-844b-3ed2b38835c5" type="checkbox" ><label for="79361708-dafe-43f3-844b-3ed2b38835c5" class="sk-toggleable__label sk-toggleable__label-arrow">StandardScaler</label><div class="sk-toggleable__content"><pre>StandardScaler()</pre></div></div></div></div></div></div><div class="sk-parallel-item"><div class="sk-item"><div class="sk-label-container"><div class="sk-label sk-toggleable"><input class="sk-toggleable__control sk-hidden--visually" id="6caca512-3692-4cc2-ae22-8682ccbe59d4" type="checkbox" ><label for="6caca512-3692-4cc2-ae22-8682ccbe59d4" class="sk-toggleable__label sk-toggleable__label-arrow">remainder</label><div class="sk-toggleable__content"><pre></pre></div></div></div><div class="sk-serial"><div class="sk-item"><div class="sk-estimator sk-toggleable"><input class="sk-toggleable__control sk-hidden--visually" id="a5b86925-e8e9-4032-8e43-b33c6b2ed682" type="checkbox" ><label for="a5b86925-e8e9-4032-8e43-b33c6b2ed682" class="sk-toggleable__label sk-toggleable__label-arrow">passthrough</label><div class="sk-toggleable__content"><pre>passthrough</pre></div></div></div></div></div></div></div></div><div class="sk-item sk-dashed-wrapped"><div class="sk-label-container"><div class="sk-label sk-toggleable"><input class="sk-toggleable__control sk-hidden--visually" id="695005d9-65af-4b32-b25f-0c17268a1ca7" type="checkbox" ><label for="695005d9-65af-4b32-b25f-0c17268a1ca7" class="sk-toggleable__label sk-toggleable__label-arrow"&g…