top of page

Airbnb maps little project

According to a mini-interview for a job application with datanauts, there were 10 different problems that I could takle. One of them was to create visualizations using a dataset with 101 variables about each airbnb location, which it was obtained from the following website: https://public.opendatasoft.com/explore/dataset/airbnb-listings/table/?disjunctive.host_verifications&disjunctive.amenities&disjunctive.features 

​

I decided to create some heatmaps first using the programming language R and the plotting package ggplot2 that comes with it. 

​

For the first type of plots, I wanted to create heatmaps (cold colors represent low values and warm colors represent high values) for different countries based on some other variable in the dataset. The different countries represented in the dataset are: Denmark, United States of America, United Kingdom, Belgium, Hong Kong, China, Spain, Ireland, Australia, Canada, Switzerland, France, Cuba, Germany, Netherlands, Greece, Austria, Italy, Vanatu, Mexico, Vatican City and Uruguay. Since most of those are in Europe, I decided to focus the maps only on Europe. If a country doesn't show up on the heatmaps, it means that there was no data for any airbnb location inside that country in the dataset. 

​

Now, since there is data for each airbnb location and I wanted to plot countries, I had to aggregate some of those airbnb locations (a total of 494954 airbnb locations) that were inside the same country. I chose to take the mean of different variables within the dataset over all the locations that are within the same country and represent this mean on the heatmaps.

 

1.   For example, in order to obtain the average weekly price of airbnb locations in each country from the dataset, I used the following code:​

weekly prices.png

In order to make the heatmaps, I used the following code. It merges by country using a 2 letter code (called wb_a2) 2 datasets. One dataset that contains all the locations of borders for each country (which helps with drawing the map) and the data I just calculated above which will give the color (warm colors for high values and cold colors for low values):

ggplot 2 code.png
avg_weekly_price_heatmap.jpg
avg_prices_heatmap.jpg
avg_availability_60days_heatmap.jpg
avg_availability_365days_heatmap.jpg
avg_monthly_prices_heatmap.jpg
avg_availability_30days_heatmap.jpg
avg_availability_90days_heatmap.jpg
avg_reviews_heatmap.jpg
ucsb-seal-2-color.jpg

University of California, Santa Barbara

  • LinkedIn Clean Grey
bottom of page