Start free →
Artificial Intelligence · Lesson 10
0 XP
Lesson 10 of 1610 minHands-on

Data: the fuel of AI.

An AI model is only as good as the data it learns from. Today you'll learn what data looks like, how to explore it with Python's pandas library, and why "garbage in, garbage out" is the first rule of AI.

Data as a table

Most AI data starts as a table: rows are examples, columns are details.

area_sqftbedroomslocalityprice_lakh
12002Tolichowki72
16503Kondapur118
9002Mehdipatnam55

Garbage in, garbage out

If the data is wrong, biased or messy, the model learns the wrong things.

ProblemExampleFix
Missing valuesSome rows have no "bedrooms"Fill sensibly or remove
Wrong valuesarea = 12 (should be 1200)Check ranges, correct or remove
DuplicatesSame flat listed 3 timesRemove duplicates
Inconsistent text"Tolichowki", "tolichowki", "Toli Chowki"Standardise spelling
Biased sampleData only from GachibowliCollect from many areas

Exploring data with pandas

In Google Colab:

import pandas as pd

data = {
    "area_sqft": [1200, 1650, 900, 1400, 2000],
    "bedrooms": [2, 3, 2, 3, 3],
    "price_lakh": [72, 118, 55, 90, 140],
}
df = pd.DataFrame(data)

print(df.head())          # first rows
print(df.describe())      # averages, min, max
print(df["price_lakh"].mean())   # average price
print(df[df["bedrooms"] == 3])   # only 3-bedroom flats

A DataFrame is pandas' version of a spreadsheet. You can sort, filter and calculate just like in Excel, but faster and with millions of rows.

Loading real data

df = pd.read_csv("your_file.csv")
df.info()           # column types and missing values
df.isnull().sum()   # count missing values per column
df = df.drop_duplicates()

You can upload a CSV in Colab using the folder icon on the left. Free datasets: Kaggle, data.gov.in (Indian government open data).

Quick check+10 XP

You want to predict whether a customer will cancel an order. What's the label?

The label is what you want the model to predict.

Privacy matters

Real data often contains people's personal information. Never share or upload private customer data to unknown tools, and follow your company's rules. Practise with public datasets.

Final check+20 XP

A model trained on loan data only from rich areas performs badly for other customers. What's the main cause?

The model only learned patterns from one group. Representative data matters.

Your task (40 min)

Go to data.gov.in or Kaggle and download a small CSV that interests you (rainfall, crops, cricket, prices). Load it in Colab with pandas. Use head(), info(), describe() and isnull().sum(). Write 3 observations about the data.

Lesson 10 complete!

You understand features and labels, data quality, and how to load and explore data with pandas. Next: your first machine learning model.

Next: Your first machine learning model →