Machine Learning Data Preparation with Pandas
Instruction: Describe the process of preparing a dataset for machine learning models using Pandas, including feature engineering and normalization.
Context: This question assesses the candidate's proficiency in using Pandas for machine learning data preparation, a critical step in the model building process.
Updated
Official answer available
Read the opening below, then unlock the full answer and practical guidance.
Define the prediction time, target and split before learning any preprocessing. Use pandas to validate schema and construct features available at prediction time; use fitted transformers for learned statistics.
```python import pandas as pd from sklearn.compose import ColumnTransformer from sklearn.impute import SimpleImputer from sklearn.pipeline import make_pipeline from sklearn.preprocessing import OneHotEncoder, StandardScaler...