Concepts 🚀 Project 🧮 Labs
🧮 Labs / ML Advanced / Preprocessing mindset — the 7 questions to ask ANY dataset

Preprocessing mindset — the 7 questions to ask ANY dataset

Before touching ML, ask these 7 questions of ANY dataset. This is how senior data scientists think — not 'load + fit'.

script.py v3.1
Python output click Run to execute
Click "Run" to execute the code on the left.
The output will appear here.
🧠 How it works

Senior data scientists don't start with model.fit(). They start with QUESTIONS. 7 questions for ANY dataset: Q1 SIZE — <100 rows = too small. >1M = need sampling. Q2 TYPES — object dtype = strings = need encoding. Q3 NULLS — >50% = drop column. 5-50% = impute. <5% = drop rows or impute. Q4 OUTLIERS — IQR method: anything outside [Q1-1.5*IQR, Q3+1.5*IQR]. Domain knowledge decides keep/remove. Q5 BALANCE — 90/10 = imbalanced. Use class_weight, SMOTE, or stratified split. Q6 DUPLICATES — same row in train + test = data leakage = fake accuracy. Q7 HEAD — the most underrated. Look at actual values. Do they make sense? This is the difference between a fresher ('load + fit') and a senior ('understand first').

✏️ Try these changes
  • Change n_samples from 1000 to 100
    → Q1 shows too-small dataset
  • Inject 60% nulls in feature_0: df['feature_0'] = df['feature_0'].where(np.random.rand(len(df)) > 0.6)
    → Q3 shows >50% nulls = drop column
  • Make the target super imbalanced: weights=[0.95, 0.04, 0.01]
    → Q5 shows severe imbalance
  • Add a categorical column: df['category'] = np.random.choice(['A','B','C'], len(df))
    → Q2 shows object dtype