TechCoder.io / AI & Machine Learning

Working with Data

Learn the essential data preprocessing steps: Loading, Cleaning, Scaling, and Visualization.

By TechCoder TeamLast updated: 2026-10-20
In a Nutshell

Learn the essential data preprocessing steps: Loading, Cleaning, Scaling, and Visualization. This hands-on tutorial focuses on practical implementation of working with data concepts.

Working with Data

Real-world data is messy. It has missing values, typos, and weird formats. Before we can train an AI model, we must preprocess the data.

This chapter covers the standard data pipeline:

  1. Loading
  2. Cleaning
  3. Scaling
  4. Visualization

1. Loading Data πŸ“₯

Data usually comes in CSV (Comma Separated Values) or JSON files. Pandas makes loading them easy.

import pandas as pd

# Load a CSV file
df = pd.read_csv('data.csv')

# Load a JSON file
df_json = pd.read_json('data.json')

2. Cleaning Data 🧹

"Garbage In, Garbage Out." If your data has errors, your model will fail.

Handling Missing Values

You can either drop missing rows or fill them (imputation).

# Check for missing values
print(df.isnull().sum())

# Option 1: Drop rows with missing values
df_clean = df.dropna()

# Option 2: Fill missing values with the average (mean)
df['Age'] = df['Age'].fillna(df['Age'].mean())

Removing Duplicates

df = df.drop_duplicates()

3. Scaling Data βš–οΈ

AI models like numbers to be on a similar scale.

  • Age: 0 - 100
  • Income: 20,000 - 200,000

If we don't scale, the model might think "Income" is more important just because the numbers are bigger.

Normalization (Min-Max Scaling): Scales data between 0 and 1.

# Simple normalization formula
df['Income_Scaled'] = (df['Income'] - df['Income'].min()) / (df['Income'].max() - df['Income'].min())

4. Data Visualization πŸ“ˆ

Always visualize your data to understand it better.

Interactive Challenge: Clean the Dataset

We have a dataset with a missing value and a duplicate. Fix it!

PYTHON PLAYGROUND
⏳ Loading editor…

Quiz

Quiz

Question 1 of 3

What does 'Garbage In, Garbage Out' mean?

You should recycle your computer
Bad data leads to bad models
AI models produce garbage output
Data cleaning is optional

Key Takeaways

βœ… Cleaning: Handle missing values and duplicates.
βœ… Scaling: Bring all features to a similar range (0-1).
βœ… Visualization: Use charts to understand your data.

What's Next?

Data is ready. Tools are ready. Now, let's build our first Machine Learning Model.

Next Module: Module 3 β€” Core Machine Learning.