Skip to content

ETL pipeline

Champions League ETL

Turned three raw Champions League CSVs into PostgreSQL tables for comparing player goals, assists, and distance covered.

  • Python
  • pandas
  • PostgreSQL
  • SQL
  • 747 rows in the main output
  • 3 source CSVs
How it works
  1. ExtractKey stats, attack, and defence CSVs
  2. TransformClean headers and convert distance to numeric
  3. LoadThree PostgreSQL tables via SQLAlchemy
  4. AnalyzePlayer rankings and Matplotlib charts

Problem and source

The 2021–22 UEFA Champions League player dataset on Kaggle splits statistics across files. I built a Python ETL workflow so an analyst could query the stats in PostgreSQL and compare season totals without cleaning each export by hand.

Cleaning and validation

The pandas scripts drop the serial field from the attack and defence files, align player and match column names, and uppercase headers. The key-stats transform treats a dash as missing in the distance field and fills missing distances with the column mean. I would preserve a missingness flag in a reporting model so an estimate cannot be mistaken for a measured distance.

Data model and output

The current loader replaces three tables: ucl_players (747 rows in the processed CSV), attack_ucl_players (176), and defence_ucl_players (627). The main table holds player, club, position, minutes, matches, goals, assists, and distance. Attack and defence add activity-specific measures. These are separate tables with no declared foreign keys. The repository includes goals, assists, and distance charts generated from the analysis.

What I would change next

Validate headers and numeric ranges before casting, report nulls and duplicate player–club pairs, and add stable player and club identifiers before joining files. I would also separate sample queries from production loads and stage each batch before replacing a published table.