encode categorical variables python multiple categories code example
Example: encoding multiple categorical variables python
from sklearn.compose import make_column_transformer
from sklearn.linear_model import LinearRegression
from sklearn.pipeline import make_pipeline
from sklearn.model_selection import cross_val_score
feature_cols = [
'fuel_type', 'make', 'aspiration', 'highway_mpg', 'city_mpg',
'curb_weight', 'drive_wheels'
]
df_ml = df.dropna(subset=['price'])
X = df_ml[feature_cols]
y = df_ml['price']