Football Altitude Data

- Data Engineer
- November 2025 – January 2026
- Completed
In numbers
- Libertadores seasons scraped, 2014 to 2024
- 11
- Cities mapped to their altitude
- 110
- Clubs with their squad market value
- 103
- Seasons of market values, 2010 to 2026
- 17
About the Project
Football Altitude Data is a dataset and the pipeline that builds it. It answers a question every fan in Quito, La Paz or Bogotá has an opinion on: does altitude decide matches in the Copa Libertadores and the Copa Sudamericana?
The first part scrapes every match from Wikipedia, group stage and knockouts, for the Libertadores from 2014 to 2024 and the Sudamericana from 2021 to 2024. Each match is stored raw, exactly as parsed, and a second step enriches it with the altitude of both teams' cities and the difference between them, from a map of 110 cities. The result is a CSV with 1,729 matches ready for analysis. The second part looks up the 103 clubs that played the Libertadores on Transfermarkt and collects their squad market value for every season from 2010 to 2026, so the altitude effect can be weighed against the money on the pitch.
I built it between November 2025 and January 2026 because I wanted numbers, not opinions. It is plain Python with Requests, PyQuery and pandas, organized as small scripts that each do one step and can be re-run on their own. In November 2026 I rebuilt it as Football Data Pipeline, which removed the duplicate matches this version produced and left the market values out, because Transfermarkt's terms forbid automated scraping.
How it works
The path a request takes, step by step.
- WikipediaGroup stage and knockouts, season by season
- ScraperRequests and PyQuery parse every match
- Raw JSONMatches exactly as parsed
- Altitudepandas joins each city with its height
- Market valueTransfermarkt history for each club
- CSV1,729 matches ready for analysis
Decisions
The choices that shaped it, and what each one cost.
Keep raw and processed data apart
- Matches are saved exactly as parsed, so the altitude step can change and re-run without scraping again.
- A parsing fix still means scraping the season again.
One file maintained by hand: the city map
- No source maps every club to the altitude of its city, so 110 cities live in one JSON file, with their teams.
- A new club needs a manual entry before its matches get an altitude.
Make the market value scraper resumable
- Searching Transfermarkt by name sometimes finds the wrong club. Each club carries a status, wrong ones are marked for retry and checked, and a run continues where it stopped.
- Slower on purpose: a delay between requests makes each phase take several minutes.
