Skip to main content
2 of 2
added 46 characters in body

Data preparation (preprocessing and data cleaning) before or after train-test split with scikit learn?

I have been practicing Data Science/Machine Learning, and I am confused about when to complete the following tasks when using train-test split in scikit learn:

  1. EDA
  2. Filling in missing data
  3. Removing data that isn't needed
  4. Working with categorical data
  5. Feature Engineering
  6. Feature Selection

I know that scaling should be done after train-test split. However, I have seen both approaches (train-test split before and after) when working with the above tasks.

I'm confused about which is the correct way for these tasks.

Can someone provide some clarification?

Thank you!