if mapping is not None:
mapping_out = mapping
for switch in mapping:
categories_dict = dict(switch.get("mapping"))
column = switch.get("col")
transformed_column = X[column].map(lambda x: categories_dict.get(x, np.nan))
try:
After Change
try:
X[column] = X[column].astype(int)
except ValueError as e:
X[column] = X[column].astype(float)
if impute_missing:
if handle_unknown == "impute":
X[column].fillna(0, inplace=True)