Exploring Airbnb data in Mexico City using geo-spatial analysis (Part One)

Kenza Bouhaj
8 min readJul 17, 2020

--

For this blog post, the Spatial Data Skill Track on DataCamp has been helpful. I thank my friends Aline Aragón and Diego Rodriguez for their guidance and advice.

Since its inception in 2008, Airbnb has become a popular service, brokering over half a billion vacation stays in over 220 countries and regions, and in 100,000 cities worldwide (Source: iPropertyManagement).

In this blog post, I explore Airbnb data in Mexico City, a metropolis that is also a popular tourist destination. While Airbnb rentals create additional revenue streams for home-owners, they can also result in undesirable consequences such as an increase in gentrification, a worsening of income inequality or an increase in noise pollution. In this blog post, I only lay out the facts about Airbnb rentals in Mexico City between March 2019 and 2020, describing how the Airbnb market changed across different metrics in Mexico City’s 16 municipalities.

The outline of this blog post is as follows:

  • Understanding the Data Sources
  • Introduction to Mexico City’s municipalities and Airbnb data
  • Number and growth of Airbnb listings per municipality
  • Price and price growth of Airbnb listings per municipality
  • Zoom over one municipality: Cuauhtemoc
  • Zoom over another municipality: Iztacalco
  • [Bonus] Selena Quintanilla’s music will be randomly distributed in this post

Understanding the Data Sources

A. Airbnb Data

Inside Airbnb is an independent, non-commercial organization that makes Airbnb data freely available in an easily-retrievable and easily-readable format on the web. The organization was created in order to “add data to the debate,” allowing users to answer questions about how Airbnb might be affecting neighborhoods and cities around the world.

The data is scraped directly from airbnb.com, and is anonymized, cleaned and aggregated. For the purposes of this blog post, I downloaded the listings.csv dataset for Mexico City in March 2019, and in March 2020.

The dataset contains the following information about each Airbnb listing during the period of time mentioned above:

  • Geo-spatial data: longitude and latitude coordinates
  • Host information (ID, whether they are a superhost)
  • Rental characteristics (type of rental, number of bedrooms, amenities included, minimum and maximum nights)
  • Price per night
  • Reviews (average ratings, text of the reviews)

For the purposes of this post, I only use: (a) geo-spatial data, (b) price per night and (c ) number of bedrooms. I create an additional, crucial variable: price per bedroom per night in order to normalize the listing prices.

B. Mexico City’s Geo-spatial Data

In order to place the above data into maps and analyze Airbnb listings by municipality and neighborhood, I retrieve geo-spatial data from the Datos Abiertos — Ciudad de Mexico (Open Source Data of Mexico City), an official data source of geo-spatial data. The data, in the form of shape files (.shp), contains geo-spatial information about municipalities and neighborhoods of Mexico City: the perimeter of each entity is determined by coordinates that form “polygons”.

To this geo-spatial data, I manually add population data for each municipality in order to calculate density of listings per capita.

C. Joining the two datasets with R

I use the Simple Features package in R to read the geo-spatial data above and join the Airbnb listings data to the Mexico City municipalities data. My final dataset contains geo-spatial information on each Airbnb listing: to which postal code, neighborhood and municipality it belongs to.

Introduction to Mexico City’s municipalities and Airbnb data

Mexico City has 16 municipalities, covering a total area of 1,487 Square Kilometers, and having a population 8.85 Million people reside (Source: Wikipedia). Each municipality in turn comprises smaller administrative divisions called “Colonias” (neighborhoods), which are themselves comprised of postal code areas. Below is a labeled map of Mexico City’s 16 municipalities.

Mexico City’s Map of its 16 Administrative Municipalities

In order to understand the growth in Airbnb listings in Mexico City, I downloaded data from March 2019 and March 2020. As the figure below shows, Mexico City’s Airbnb listings in March 2019 totalled ~17K, while that same number reached ~21.7K in March 2020. This growth represents a 27% year over year increase in the number of listings between 2019 and 2020. Considering the effect of the COVID-19 pandemic (which started to be strongly felt in Mexico City around March 2020), the increase is nonetheless important.

Mexico City’s growth in Airbnb listings (2019 vs 2020)

Number and growth of Airbnb listings per municipality

Before we start with the fun stuff, I think it is time to listen to Selena Track #1.

A. Absolute number of listings, March 2020

Map of Airbnb listings per municipality, March 2020

The figure maps the number of Airbnb listings in March 2020 in Mexico City per municipality. We observe that the majority of municipalities have less than 2,000 listings, while most listings are concentrated in 4 municipalities: Cuauhtemoc (> 8000), Miguel Hidalgo, Benito Juarez and Coyoacan.

B. Growth in number of listings, 2019–2020

Map of % growth in Airbnb Listings, March 2019–2020

Between March 2019 and March 2020, we observe that the number of listings grew by at least 20% in all municipalities. As expected, the municipalities with an already large number of listings (e.g, Alvaro Obregon) grew the least while municipalities in the southern and eastern part of the city grew by the largest percentage.

Bar graph of listings growth by municipality, March 2019–2020

Taking a closer look at the % growth of listings in each municipality, we see that Milpa Alta, Venustiano Carranza, Iztacalco and Iztapalapa are the four municipalities with the highest growth in listings, each exceeding 50% from March 2019 to 2020.

C. Putting the metrics together

In the graph below, we show municipalities as a scatter plot of the number of listings per capita against the number of listings per square kilometers in March 2020, sized by the growth in listings between March 2019–2020.

Airbnb Listing Densities in CDMX, March 2020

Based on the graph above, the municipalities with the largest density of Airbnb listings are:

  • Cuauhtemoc, with 257 listings per square kilometers and 0.015 listings per capita (that is, 15 listings for every 1,000 inhabitants)
  • Benito Juarez, with 127 listings per square kilometers and 8 listings for every 1,000 inhabitants.
  • Miguel Hidalgo, with 76 listings per square kilometers and 9 listings for every 1,000 inhabitants.

Woah, that was a lot of data! Selena Track #2 to take a break.

Price and price growth of Airbnb listings per municipality

To normalize prices across different Airbnb rental types, I calculate the average price per bedroom per night for each listing.

A. Average Price in March 2020

Average Airbnb price per bedroom in MXN Pesos, March 2020

In this map, we observe that the average price across most municipalities is below MXN $500 per night (around USD 25). As expected, the highest prices are around the northern and western parts of the city, notably Miguel Hidalgo, Cuauhtemoc and Cuajimalpa de Morelos, where the average price per bedroom per night can be as high as MXN $1000.

B. Price variance across the municipalities

In order to understand the extent of the price variance across the difference municipalities, we look at the box plots below, which draw the minimum, maximum, median and outlier measures of prices across municipalities, in March 2020.

Box plots of Airbnb average prices across CDMX municipalities

In the graph above, it is interesting to note that prices can go as high as MXN $10,000 per night (USD ~500), in the majority of municipalities. Municipalities with the widest variance in prices (including outliers) are Miguel Hidalgo, Cuajimalpa de Morelos and Cuauhtemoc.

To better illustrate the variance across municipalities, below is a view of the boxplot that excludes outliers (prices below MXN $1,000)

Boxplots of prices in March 2020, excluding outliers

B. Price growth across the municipalities from March 2019 to March 2020

Map of Airbnb price trends March 2019 vs. 2020

The set of figures below show the progression of Airbnb average prices between March 2019 and March 2020.

As this map shows, Airbnb average prices have increased between March 2019 and March 2020 in most municipalities, while it has decreased in a handful, notably in the southern part of Mexico City.

In the figure below, we see that Cuauhtemoc is the municipality with the highest price increase (~12%), followed by Coyoacan (~11%) and Alvaro Obregon (~8%). Surprisingly, Iztapalapa and Iztacalco also witnessed price increases of ~6–8%.

Now is a good time to listen to Selena Track #3.

Zooming over Cuauhtemoc

Cauhtemoc has consistently distinguished itself across all metrics. Indeed, it is the municipality with the largest number of listings, the highest average prices, and the highest price increase between March 2019 and 2020.

So what do these metrics look like if we zoom over postal codes in this municipality?

A. Listings per postal code

B. Listing growth per postal code

C. Average price per postal code

D. Price growth per postal code

Zooming over Iztacalco

A. Listings per postal code

B. Listing growth per postal code

C. Average price per postal code

D. Price growth per postal code

Conclusion

Beyond the descriptive nature of this post, we can use Airbnb data to draw insights about a range of questions, including:

  • How much revenue is generated by Airbnb home-owners in a given neighborhood?
  • Is an increase in Airbnb’s listings and prices in a given neighborhood associated with rent increases, gentrification or economic growth?
  • How does the supply of Airbnb listings compare to that of hotels? and are the two mutually exclusive or complementary in developing the tourism industry?
  • Which city amenities (e.g., proximity to the metro, parks, museums) are associated with the highest number of Airbnb listings and the highest prices?

In my next blog post, I will pick one of the questions above and explore it futher to draw more insights.

Again, if you’ve read all the way, thank you very much. Please leave a comment if you’d like to discuss this further. And as a goodbye note, this is the final Selena track!

--

--

Kenza Bouhaj
Kenza Bouhaj

Written by Kenza Bouhaj

Curious. Passionate about storytelling through data. Interested in Work, Skills and EdTech. Twitter: @KenzaBouhaj

Responses (4)