Skip to content

Israeladebisi/Airbnb_Geospatial_Analysis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

8 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Airbnb Barcelona: A Geospatial Analysis

This project explores and visualizes publicly available Airbnb listing data for Barcelona, Spain, using Python's geospatial libraries. By mapping listings onto neighborhood boundaries, we analyze and visualize key metrics like listing density and median prices to uncover spatial patterns and trends.

Python Jupyter Pandas GeoPandas Matplotlib Contextily

Note: Listings come from publicly available Airbnb archives.
This notebook visualizes locations, densities, and neighborhood-level median prices (for Entire home/apt) across multiple listing snapshots.


Project Overview

This repository contains a Jupyter Notebook (airbnb_barcelona.ipynb) that guides you through a geospatial analysis of Airbnb listings. The process involves:

  • Data Preparation: Loading and cleaning Airbnb listings and geospatial data for Barcelona's neighborhoods and districts.
  • Geospatial Joins: Merging listing data with neighborhood geometries to enable spatial analysis.
  • Metric Calculation: Computing the count, density, and median price of "Entire home/apt" listings for each neighborhood.
  • Visualization: Creating choropleth maps to visually represent these metrics across Barcelona, revealing how listings are distributed.

Key Visualizations & Findings

The analysis focuses on creating compelling choropleth maps to answer key questions about Barcelona's Airbnb market.

  1. Listing Count & Density We calculate the raw number of "Entire home/apt" listings per neighborhood, as well as the listing density (listings per square kilometer). The maps reveal a clear concentration of listings in the central districts, particularly in the Ciutat Vella area.

  2. Median Price Distribution By plotting the median price of listings, we observe a distinct spatial pattern. Neighborhoods with higher listing densities in the city center often correlate with higher median prices, though some outlying areas also command premium rates.


πŸ› οΈ Tech Stack

Core: Python 3.7+ and Jupyter Notebook for interactive analysis.

  • Data Handling: Pandas and NumPy for data manipulation and calculations.
  • Geospatial: GeoPandas (geometries/joins), Contextily (web basemaps)
  • Visualization: Matplotlib for creating the maps and plots.

πŸ“¦ Getting Started

Installation

Using a virtual environment is recommended.

# (optional) Create and activate a virtual environment
python -m venv .venv
# Windows: .venv\Scripts\activate
# macOS/Linux: source .venv/bin/activate

python -m pip install --upgrade pip
pip install pandas numpy geopandas matplotlib contextily

** Using conda (recommended for Geopandas)

conda create -n airbnb-geo python=3.9 -y
conda activate airbnb-geo
conda install -c conda-forge geopandas contextily matplotlib pandas numpy -y

πŸš€ Run

  1. Clone this repository.
  2. Activate your virtual environment (pip or conda).
  3. Launch Jupyter Notebook from the project directory.
jupyter notebook
# open notebooks/airbnb_barcelona.ipynb and run cells top-to-bottom
  1. Open airbnb_barcelona.ipynb and run the cells from top to bottom.

Project Structure

Data/
β”œβ”€ barris.geojson        # neighborhoods (polygons, includes AREA)
β”œβ”€ districts.geojson     # districts (polygons)
β”œβ”€ listings_24.csv
β”œβ”€ listings_30.csv
β”œβ”€ listings_33.csv
└─ listings_45.csv
airbnb_barcelona.ipynb
README.md

πŸ“Š Metrics per Neighborhood

  • Count: number of Entire home/apt listings per neighborhood
  • Density: count / AREA (AREA from barris.geojson)
  • Median price: median price per neighborhood These are merged onto the neighborhoods GeoDataFrame and visualized as choropleths (single and four-panel). Use a consistent CRS (e.g., EPSG:3857) before adding Contextily basemaps.

Data and License

This project is for educational and analytical purposes only. The Airbnb data used is publicly available.

About

Experimenting with geopandas and other visualization libraries in python

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published