Question 1
Given the following code snippet that preprocesses a dataset with both continuous and categorical features using sklearn.preprocessing tools, what will be the first row of the X_transformed array after preprocessing?
import numpy as npfrom sklearn.preprocessing import MinMaxScaler, OneHotEncoderfrom sklearn.compose import ColumnTransformer
X = np.array([[2.0, 'apple'], [5.0, 'banana'], [1.0, 'apple'], [4.0, 'cherry']])
preprocessor = ColumnTransformer( transformers=[('num', MinMaxScaler(), [0]), ('cat', OneHotEncoder(), [1])])
X_transformed = preprocessor.fit_transform(X)print(X_transformed[0])