The California Housing Dataset

The California Housing Dataset
Download
[free_download_btn]

If you've spent any time learning data analysis or machine learning, you've probably run into the Iris dataset, the Titanic dataset, or maybe the Boston Housing dataset (which, by the way, got pulled from most libraries over ethical concerns). But there's one dataset that deserves way more attention than it gets: the California Housing Dataset.

I've used this dataset in tutorials, practice projects, and even to teach regression concepts to people just starting out, and it keeps proving itself as one of the most practical, real-world friendly datasets you can work with. Let me walk you through why it's worth your time and how to actually get value out of it.

What is the California Housing Dataset?

The dataset comes from the 1990 California census and was originally compiled by Pace and Barry for a 1997 paper on spatial statistics. You can grab a cleaned-up version on Kaggle, uploaded by Cam Nugent, which is the version most people use today.

It contains information about housing in California, grouped by block. Each row represents a block group, which is the smallest geographical unit the US Census Bureau publishes data for, usually covering a population of 600 to 3,000 people.

The columns include:

longitude and latitude (location of the block group)
housing_median_age (median age of houses in the block)
total_rooms and total_bedrooms (aggregated, not per house)
population and households
median_income (in tens of thousands of dollars)
median_house_value (the target variable most people try to predict)
ocean_proximity (categorical, describes how close the block is to the ocean)

That's it. About 20,000 rows and 10 columns. Small enough to load and explore quickly, but rich enough to teach real analytical thinking.

Why this dataset is actually great for practice

A lot of beginner datasets are too clean. Everything lines up, there's nothing weird going on, and you never learn what to do when real data throws a curveball at you. The California Housing Dataset sits in a nice middle ground. It's clean enough that you're not fighting the data the whole time, but it has just enough quirks to make you think.

For example, total_rooms and total_bedrooms are aggregated at the block level, not per household. If you don't catch that, you'll build features that don't make sense. You need to divide by households to get something like rooms per household, which is a much more useful metric. That single realization teaches a lesson a lot of "perfect" datasets never will: always understand what a column actually represents before you use it.

There are also a small number of missing values in total_bedrooms, which gives you a low-stakes way to practice handling missing data without getting overwhelmed.

What you can actually build with it

This dataset works well for a range of skill levels and goals.

If you're learning regression, median_house_value is a natural target. You can start with a simple linear regression using median_income, since income and house value are strongly correlated, then work your way up to more complex models using all the features.

If you're practicing feature engineering, this dataset is a goldmine. You can create rooms_per_household, bedrooms_per_room, and population_per_household, all of which tend to improve model performance more than the raw aggregated columns do.

If you're into geospatial analysis, the longitude and latitude columns let you plot housing prices on an actual map of California. This is one of the more satisfying parts of working with this dataset because you can visually confirm what you'd expect: coastal areas and areas near San Francisco and Los Angeles are more expensive.

If you're practicing SQL or Power BI, you can load this into a database or BI tool and build out summary tables, filters by ocean_proximity, and dashboards showing average house value by region.

A quick walkthrough of a simple analysis

Say you want to explore the relationship between income and house value. In Python with pandas, it looks something like this:

import pandas as pd

df = pd.read_csv('housing.csv')
df['rooms_per_household'] = df['total_rooms'] / df['households']
df['bedrooms_per_room'] = df['total_bedrooms'] / df['total_rooms']

correlation = df['median_income'].corr(df['median_house_value'])
print(correlation)

You'll find a strong positive correlation, usually somewhere around 0.68 to 0.70. That's already a useful insight, and it's the kind of thing you can build an entire beginner project around: exploratory data analysis, a correlation heatmap, then a basic linear regression model.

If you want to take it further, try grouping by ocean_proximity and comparing average house values. You'll see a clear pattern where properties near the ocean or bay are priced significantly higher than inland properties, which lines up with what anyone familiar with California real estate would expect.

Common mistakes people make with this dataset

A few things trip people up.

First, treating total_rooms and total_bedrooms as if they're per-house numbers instead of per-block totals. This throws off any analysis that doesn't account for household count.

Second, ignoring the categorical ocean_proximity column entirely. It's one of the more predictive features in the dataset and deserves proper encoding (one-hot encoding works well) rather than being dropped because it's not numeric.

Third, not checking for outliers in median_house_value. The original data caps house values at 500,001, meaning any house genuinely worth more than that gets lumped into the same number. If you don't catch this, your model will treat that cap as a real ceiling rather than a data limitation.

Conclusion

The California Housing Dataset hits a sweet spot that a lot of beginner datasets miss. It's realistic without being overwhelming, clean without being sanitized to the point of uselessness, and versatile enough to support regression, feature engineering, geospatial visualization, and BI dashboarding all from the same source.

If you're building a portfolio project, this is a solid pick because interviewers and hiring managers will actually recognize it, and it gives you room to show real analytical judgment instead of just running a model on data that required zero thinking.

  • Version
  • Download 3
  • File Size 0.00 KB
  • File Count 1
  • Create Date August 11, 2026
  • Last Updated August 11, 2026
FileAction
california-housing-pricesDownload

Leave a Reply

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

Scroll to Top