train_test_split
Split a dataframe into train and test sets for model validation. Preserve class proportions with stratify, and ensure reproducibility with a fixed random_state.
Instructions
Split dataframe into train/test sets. Stores them as '{name}_train' and '{name}_test'. stratify=True preserves target class proportions (classification only). Run BEFORE training any model. Always use fixed random_state for reproducibility. Use stratify=True for imbalanced classification datasets. Example: train_test_split(target_column="Revenue", test_size=0.2)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| df_name | No | ||
| stratify | No | ||
| test_size | No | ||
| random_state | No | ||
| target_column | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |