Real-world datasets

Working with Real-World Datasets: A Practical Guide to Kaggle and UCI Data

Every machine learning course starts the same way. You load a tidy CSV file. Every column already makes sense. No cell is empty. No label is misspelled. Then one day, you download a real-world dataset for your own project, and none of that is true anymore.

This is the moment every beginner hits, and it catches most people off guard. So in this article, and in the companion video on the Intelevo channel, we walk through exactly what changes once you leave the classroom and start working with real-world datasets from platforms like Kaggle and the UCI Machine Learning Repository. By the end, you will know where to find good data, how to understand what each column actually means, and how to clean it properly before you train a single model.

Let’s get into it.

Why Real Data Feels So Different

Textbook datasets exist to teach a concept. Because of that, someone has already stripped out the mess. Real datasets, on the other hand, come straight from the source. A hospital’s patient records, a company’s sales logs, a city’s housing sales — none of these were built for you. They were built for someone else’s purpose first, and you are simply reusing them.

As a result, real datasets carry the fingerprints of real collection: missing entries, inconsistent formatting, duplicate records, and the occasional value that makes no sense at all. This is not a flaw in the data. It is simply what data looks like before anyone cleans it.

Here’s the rule of thumb to keep in mind: a model is only as good as the data it’s fed. Messy data is the norm, not the exception. Therefore, learning to clean it isn’t a chore you skip — it’s a core modeling skill, just like feature engineering or hyperparameter tuning.

An Analogy Worth Remembering: The Used-Car Lot

To make this concrete, picture a raw dataset as a used car listed online. You wouldn’t drive it home the moment you found it. Instead, you’d move through a few sensible steps first.

First, you browse the listings. In our analogy, Kaggle and UCI are the two lots you visit, each with its own kind of inventory. Next, you inspect the car before buying it. That means reading the data dictionary and looking closely at each column, much like checking a car’s spec sheet before signing anything. After that, you fix what’s broken — missing parts, incorrect labels, duplicate components — before you go anywhere with it. Finally, once everything checks out, you take it home. Only then is the dataset actually ready for modeling.

Keep this analogy in your back pocket. We’ll return to it throughout the rest of this guide.

Where to Find Real Datasets: Kaggle vs. UCI

So, where do you actually go shopping for data? Two sources come up again and again, and each has a different personality.

Kaggle is a community platform built around competitions and shared notebooks. Because thousands of people upload datasets here, you’ll find enormous variety — everything from tidy, well-labeled tables to genuinely messy dumps of raw information. This variety is actually an advantage: it means Kaggle reflects real submissions from real people, not sanitized samples. It’s a great place to practice, study other people’s code, and stay current with trends in the field.

The UCI Machine Learning Repository, meanwhile, takes a different approach. It’s an academic archive curated specifically for research and teaching. The collection is smaller, but every dataset is well documented and stable. In fact, many of the field’s most-cited benchmark datasets live here. Because UCI ships with a clear attribute list for nearly every dataset, you’ll rarely find yourself guessing what a column means.

In short: use Kaggle when you want breadth, competition practice, and community code. Use UCI when you want a dependable, well-documented dataset for serious study.

Step 1: Take a First Look Before You Touch Anything

Once you’ve picked a dataset, resist the urge to start cleaning immediately. First, look at the shape of what you’ve got. This first look tells you what you’re actually working with, and it only takes four lines of pandas.

import pandas as pd

df = pd.read_csv("dataset.csv")

print(df.shape)
print(df.head())
print(df.info())
print(df.describe())

Here’s what each call gives you. shape tells you how many rows and columns you have. head() shows the first few rows, so you can eyeball the data. info() reveals column types and missing-value counts in one glance. And describe() produces a quick statistical summary of your numeric columns.

Together, these four calls are your first handshake with any new dataset. Before you decide anything else, run them.

Step 2: Read the Data Dictionary First

Column names alone can mislead you, and this is where many beginners get tripped up. A data dictionary — Kaggle’s description tab, or the names file that ships with a UCI dataset — explains what each column truly means, what units it uses, and what any numeric codes actually stand for.

Consider a housing dataset with a column called sqft_lot15. At first glance, it looks like just another size measurement. However, the “15” actually refers to the year 2015, not the year of sale. Miss that detail, and you might accidentally compare figures from different years as if they were the same thing.

Or take zipcode. It looks numeric, so it’s tempting to average it or feed it straight into a regression model. But a zip code is a location label, not a quantity — averaging two zip codes produces a meaningless number. Similarly, a column like condition might use integers from 1 to 5, but those numbers represent an ordered rating, not a continuous scale. And yr_renovated might use 0 to mean “never renovated” — which looks like a year, but definitely isn’t one.

The lesson here is simple: always read the dictionary before you trust a column. It takes five minutes and saves you from building a model on a misunderstanding.

Step 3: Run the Messy-Data Checklist

With the dictionary in hand, you’re ready to hunt for problems. Five checks catch almost every real-world issue, so run through them on any new dataset.

  1. Missing values. These show up as empty cells, and pandas reads them as NaN. Check every column, not just the ones you expect to have gaps.
  2. Wrong data types. Numbers stored as text, or dates stored as plain strings, silently break calculations later on.
  3. Duplicate rows. The same record entered twice quietly inflates how much data you actually have.
  4. Inconsistent categories. Values like “NY”, “ny”, and “New York” often represent the same thing, yet a computer treats them as three different categories.
  5. Outliers. A handful of extreme values can quietly drag averages — and your model’s performance — off course.

Once you’ve spotted these issues, it’s time to fix them.

Cleaning It Up: Missing Values

For missing values, you have two honest choices: fill the gap sensibly, or remove it. Which one you choose depends on the column and how much is missing.

print(df.isnull().sum())

# fill numeric gaps with the median
df["age"].fillna(df["age"].median(), inplace=True)

# drop rows missing the target
df.dropna(subset=["target"], inplace=True)

Filling, also called imputing, works well when a column is mostly useful and only a small portion is missing. Dropping makes more sense when the missing value sits in your target column — after all, you can’t train a model on an answer that isn’t there.

Cleaning It Up: Types and Duplicates

Next, fix data types and remove duplicates. Wrong types hide in plain sight. A date stored as text, for example, can’t be sorted or compared correctly until you convert it.

df["date"] = pd.to_datetime(df["date"])
df["zipcode"] = df["zipcode"].astype(str)

print(df.duplicated().sum())
df.drop_duplicates(inplace=True)

Converting types lets pandas handle each column the way it should: dates as dates, and codes like zip codes as text rather than numbers. Meanwhile, dropping duplicates makes sure every row counts exactly once, so you’re not accidentally training your model on repeated information.

Cleaning It Up: Outliers and Inconsistent Categories

Finally, tackle sloppy labels and extreme values. Both distort what a model learns, so it’s worth handling them together.

print(df["city"].value_counts())

df["city"] = df["city"].str.strip().str.lower()

Q1, Q3 = df["price"].quantile([.25, .75])
IQR = Q3 - Q1
df = df[df["price"].between(Q1 - 1.5*IQR, Q3 + 1.5*IQR)]

Checking value_counts() on a category column quickly reveals messy labels. Trimming whitespace and lowercasing text merges duplicate categories back into one clean group. For outliers, the IQR — or interquartile range — rule offers a simple, distribution-free way to flag values that fall far outside the normal spread, without assuming your data follows a bell curve.

Drop It, or Fill It In?

There’s no single correct answer here. Instead, match your approach to how much data is missing and how much that column matters to your model.

ApproachBest WhenTradeoff
Median imputeNumeric column, gaps are small to moderateSlightly narrows the natural spread of values
Mode / “Unknown”Categorical column with a handful of gapsCan mask a pattern behind why data went missing
Drop the columnMore than roughly 40–50% is missingLoses that feature and any signal it carried
Drop the rowsVery few rows affected, dataset is largeWastes data if the gaps aren’t purely random

Use this table as a quick decision guide the next time you’re staring at a column full of gaps.

The One Mistake to Avoid: Clean After You Split, Not Before

Here’s a mistake worth calling out clearly, because it connects directly to a lesson from an earlier episode on train-test splitting. The same leakage rule applies to cleaning as it does to splitting: any statistic you use to clean your data — a median, a mode, a category count — must come from the training data alone.

The wrong order looks like this: clean and impute the whole dataset, then split it into train and test sets. The right order flips that sequence: split first, then fit your median, mode, or scaler using only the training data.

Why does this matter so much? Because fitting on the full dataset lets information from your test set quietly leak into training. Your test score then looks better than it should, and you won’t discover the problem until your model underperforms on genuinely new data. Avoid this trap, and your evaluation stays honest.

Where This Shows Up in Real Life

This isn’t just an academic exercise. On Kaggle leaderboards, top competitors actually spend most of their time cleaning data, not tuning models — the cleanup often decides the outcome more than the algorithm does. UCI-style, well-documented datasets underpin countless published research benchmarks. In business analytics, sales and customer data typically arrive from multiple systems that rarely agree with each other, so cleaning becomes a daily task rather than a one-time step. And in production machine learning pipelines, companies automate exactly these checks before every model retrain, because no one wants a pipeline to fail silently on bad input.

Quick Self-Test

Try this before moving on. A column called zipcode is stored as a number. You leave it that way and feed it straight into your model. What’s the problem?

A) Nothing — a number is a number, the model handles it fine. B) The model may treat zip codes as having size or order, which they don’t. C) You should have deleted the column instead of checking its type.

The correct answer is B. Zip codes are location labels, not quantities. Treat them as categorical data — the same care you’d give to condition or yr_renovated, as we saw earlier.

What You Can Now Do

Let’s recap what this guide covered. You can now find real datasets by comparing Kaggle and UCI, and picking the right source for your project. You can read a data dictionary and understand what a column truly means before you trust it. You can spot what’s broken in a dataset — missing values, wrong types, duplicates, and outliers. And, most importantly, you can clean all of it safely, using training data only, so your evaluation scores stay honest.

Watch the Full Walkthrough

This article accompanies the full video walkthrough on the Intelevo YouTube channel, where every step above gets demonstrated live, complete with the running used-car analogy and a quick self-test at the end. If you’d like to see the code in action and follow along at your own pace, the video is the best place to start.

Up next, Episode 30 brings everything together: Building Your First End-to-End Data Pipeline. You now know how to find real datasets and clean them by hand. In the next episode, we string every step into one repeatable pipeline, moving from a raw file to model-ready data in a single run.

If this guide helped you, consider subscribing to Intelevo on YouTube, and feel free to share your thoughts in the comments. Every question helps shape future episodes.

Leave a Comment

Your email address will not be published. Required fields are marked *