Skip to content

NN-Coder/f1-data-analysis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

F1 Data Analysis: Constructor Racecraft Performance

This project analyzes historical Formula 1 race result data to evaluate constructor-level racecraft through Average Positions Gained (APG), defined as:

APG = grid position - final position

A higher APG indicates that, on average, a team improves more positions between the race start and finish.

Project Goals

  • Quantify which constructors gain the most positions during races.
  • Compare APG against sample size (total race entries) to highlight variance in small datasets.
  • Provide both static and interactive visualizations for exploratory analysis.

Repository Structure

.
├── data/
│   ├── constructors.csv
│   └── results.csv
├── scripts/
│   ├── main.py
│   ├── scatter-plot.py
│   └── interactive-scatter-plot.py
├── Dockerfile
└── requirements.txt

Data Sources

Analysis Walkthrough

Scripts

  • scripts/main.py
    Core APG analysis with console output and a bar chart of top teams.

  • scripts/scatter-plot.py
    Static scatter plot showing APG vs total entries (log-scaled x-axis).

  • scripts/interactive-scatter-plot.py
    Interactive Plotly scatter plot for deeper exploratory analysis.

How to Run

Option 1: Local Python Environment

  1. Install dependencies:
    pip install -r requirements.txt
  2. Run the primary analysis:
    python scripts/main.py
  3. Run visualization scripts:
    python scripts/scatter-plot.py
    python scripts/interactive-scatter-plot.py

Option 2: Docker

Build the image:

docker build -t f1-data-analysis .

Run the default analysis script:

docker run --rm -it -v "$(pwd):/app" f1-data-analysis

Run specific scripts:

docker run --rm -it -v "$(pwd):/app" f1-data-analysis python scripts/scatter-plot.py
docker run --rm -it -v "$(pwd):/app" f1-data-analysis python scripts/interactive-scatter-plot.py

Methodology Summary

  1. Load race results and keep only constructor ID, grid position, and final classified position.
  2. Compute per-race positions gained for each constructor entry.
  3. Aggregate APG by constructor and compute total race entries.
  4. Merge constructor metadata for readable team names.
  5. Apply entry-count thresholds where appropriate to reduce small-sample distortion.
  6. Compare central trend and variance through ranked tables and scatter plots.

Key Interpretation Notes

  • Teams with very few race entries can produce extreme APG values that are not stable estimates.
  • Entry thresholds and log-scaled visualizations are used to make comparisons more statistically meaningful.
  • APG captures race-day progression, not overall team performance across qualifying, reliability, or points systems.

About

Analyzing F1 race data with Python, Pandas, MatPlotLib, Seaborn, and Plotly to figure out the team with the highest average places gained from start to finish.

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Contributors