How run sklearn.preprocessing.OrdinalEncoder on several columns?
How run sklearn.preprocessing.OrdinalEncoder on several columns? Question: this code raise error: import pandas as pd from sklearn.compose import ColumnTransformer from sklearn.pipeline import Pipeline from sklearn.preprocessing import OrdinalEncoder # Define categorical columns and mapping dictionary categorical_cols = [‘color’, ‘shape’, ‘size’] mapping = {‘red’: 0, ‘green’: 1, ‘blue’: 2, ‘circle’: 0, ‘square’: 1, ‘triangle’: 2, ‘small’: 0, …