Nairobi, the bustling capital city of Kenya, is experiencing rapid population growth and urbanization. As a result, the demand for affordable and quality housing has skyrocketed in recent years. In this project, we will explore the housing prices in Nairobi.
The increasing urban population in Nairobi has led to a surge in demand for housing, causing a rise in property prices. Despite the demand, the supply of affordable housing remains limited. This imbalance has resulted in a housing crisis, with many residents struggling to find suitable accommodation.
The objective of this project is to determine whether rent prices are influenced more by home size or location.
In this project, we will work with a dataset with 4,000+ properties for rent in Nairobi through the real estate website Property24.co.ke.
Import Libraries
Preparing the Data

DATA CLEANING

EXPLANATORY DATA ANALYSIS

CATEGORICAL DATA: ADDRESS
Below are the most prevalent estates in our dataset:
There seem to be some inconsistencies in our data. Let’s simplify and optimise a dictionary to map old addresses to their corresponding replacements and then apply the replacements in a single step.
NUMERICAL DATA: PRICE
We have a sense for where the residential houses in our dataset are located, but how much do they cost on a monthly basis? How big are they?
Notice that the mean is slightly higher than the median (50% quantile), and the standard deviation is lower than the mean which means the monthly rent price is more concentrated around the mean.


LOCATION OR SIZE
Which locations have the most expensive houses to rent?
Do housing prices vary by state? If so, which are the most expensive estates for renting a house? During our explanatory data analysis, we used descriptive statistics like mean and median to get an idea of the typical house price in Nairobi. Now, we need to break that calculation down by location and visualise the results.

Now we see that Karen is by far the most expensive residential estate. Additionally, many of the top 5 estates are the most expensive residential estate in the real estate market. So it looks like this bar chart is a more accurate reflection of residential real estate markets.
Is there a relationship between home size (number of bedrooms) and price?

There is definitely a positive correlation, in other words, the more bedrooms in a residential house, the higher the monthly price.
The correlation coefficient is 0.62, so there’s a moderate positive relationship between home size and price in Nairobi.
CONCLUSION
The relationship between home size and price does hold true in the country’s biggest and most economically powerful urban center, Nairobi.