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_sqft | bedrooms | locality | price_lakh |
|---|---|---|---|
| 1200 | 2 | Tolichowki | 72 |
| 1650 | 3 | Kondapur | 118 |
| 900 | 2 | Mehdipatnam | 55 |
- Features: the inputs (area, bedrooms, locality).
- Label / target: what we want to predict (price).
Garbage in, garbage out
If the data is wrong, biased or messy, the model learns the wrong things.
| Problem | Example | Fix |
|---|---|---|
| Missing values | Some rows have no "bedrooms" | Fill sensibly or remove |
| Wrong values | area = 12 (should be 1200) | Check ranges, correct or remove |
| Duplicates | Same flat listed 3 times | Remove duplicates |
| Inconsistent text | "Tolichowki", "tolichowki", "Toli Chowki" | Standardise spelling |
| Biased sample | Data only from Gachibowli | Collect 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).
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.
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.
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 →