"Preprocessing Over Models"
I practiced preprocessing step by step on the House Prices dataset. The goals were to detect and handle missing values, apply different strategies for numeric and categorical columns, understand copying, remove outliers, and compare before and after.
Filling Missing Values Differently
First I assessed the missing picture.
df.isnull().sum().sort_values(ascending=False)- Computed missing count and ratio and visualized the top columns with
barh - For the numeric
LotFrontage, compared mean and median and filled with the median, which is less sensitive to outliers - For the categorical
GarageType, filled with the string'None'since missing may mean 'no garage'
The key was that the same missingness is handled differently depending on the column's meaning.
Shallow vs Deep Copy
This was the most confusing yet crucial concept. A shallow copy copies the surface while the inner data stays linked to the original, so changing one may change the other. A deep copy (df.copy()) is a fully independent duplicate. I learned to always be conscious of "is what I'm handling a copy or the original?" so I don't accidentally corrupt the source during preprocessing.
Outlier Removal (IQR)
I computed Q1, Q3, IQR = Q3 - Q1, and treated values outside Q1 - 1.5*IQR to Q3 + 1.5*IQR as outliers.
Takeaway
Key point
Preprocessing wasn't "cleaning data" but "judging by meaning." It became practice in attaching a reason to each decision: why the median, why 'None', why drop this row.