A comprehensive Jupyter notebook for analyzing Formula 1 driver telemetry data using the FastF1 library. This project provides real-time F1 data access, visualization, and analysis capabilities.
- Real F1 Data Access: Connect to official Formula 1 telemetry data using FastF1
- Driver Analysis: Analyze individual driver performance and telemetry
- Multiple Visualizations: Static (matplotlib) and interactive (plotly) charts
- Driver Comparison: Compare performance between different drivers
- Data Export: Export telemetry data to CSV for further analysis
- Robust Error Handling: Gracefully handles missing telemetry data
- Performance Optimized: Includes caching for faster data loading
- Speed (km/h)
- Throttle (%)
- Brake (%)
- Gear (when available)
- RPM (when available)
- Steering Angle
- Distance (track position)
- Lap Times
- Sector Times
- Pit Stop Times
- Position Data
- Weather Conditions
- Tire Information
- Track Layout
- Python 3.8+
- Jupyter Notebook
-
Clone the repository:
git clone https://github.com/lspellman-opsguru/f1-data.git cd f1-data -
Install dependencies:
pip install -r requirements.txt
-
Launch Jupyter Notebook:
jupyter notebook f1_telemetry_analysis.ipynb
-
Run the cells to start analyzing F1 data!
- Select a Race: Choose from available F1 races (2023-2024)
- Pick a Driver: Select a specific driver to analyze
- Get Telemetry: Extract detailed telemetry data for analysis
- Visualize: Create charts and graphs of driver performance
import fastf1
import os
# Enable caching
os.makedirs('cache', exist_ok=True)
fastf1.Cache.enable_cache('cache')
# Load a race
race = fastf1.get_session(2024, 'Bahrain', 'R')
race.load()
# Get driver data
driver_laps = race.laps.pick_driver('VER')
fastest_lap = driver_laps.pick_fastest()
telemetry = fastest_lap.get_telemetry()
# Analyze speed profile
import matplotlib.pyplot as plt
plt.plot(telemetry['Distance'], telemetry['Speed'])
plt.title('Speed Profile')
plt.show()- Setup & Connection - Import libraries and connect to F1 data
- Race Selection - Choose race and driver
- Telemetry Extraction - Get detailed telemetry data
- Visualizations - Multiple chart types and analysis
- Advanced Analysis - Statistical summaries and correlations
- Driver Comparison - Compare multiple drivers
- Data Export - Save data for further analysis
fastf1>=3.1.0- F1 data accesspandas>=1.5.0- Data manipulationnumpy>=1.21.0- Numerical computingmatplotlib>=3.5.0- Static plottingseaborn>=0.11.0- Statistical visualizationplotly>=5.0.0- Interactive plottingjupyter>=1.0.0- Notebook environment
- Speed profiles over distance
- Throttle and brake input analysis
- Lap time comparisons
- Gear usage patterns
- Multi-panel telemetry displays
- Zoomable and hover-enabled charts
- Dynamic data exploration
- Speed Analysis: Track speed variations and top speeds
- Driving Style: Throttle/brake patterns and gear usage
- Performance Comparison: Driver vs driver analysis
- Statistical Summary: Key performance metrics
The notebook automatically creates a cache/ directory for storing downloaded F1 data. This improves performance by avoiding re-downloading the same data.
Different F1 sessions may have varying levels of telemetry data. The notebook handles missing data gracefully and will show available information.
f1-data/
├── f1_telemetry_analysis.ipynb # Main analysis notebook
├── requirements.txt # Python dependencies
├── cache/ # FastF1 data cache (auto-created)
└── README.md # This file
- Performance Analysis: Understand driver performance patterns
- Race Strategy: Analyze tire usage and pit stop strategies
- Technical Analysis: Study car setup and driving techniques
- Educational: Learn about F1 data analysis and visualization
- Research: Use data for machine learning or statistical analysis
Contributions are welcome! Feel free to:
- Add new visualization types
- Improve data analysis methods
- Add support for additional F1 data sources
- Enhance error handling
- Add documentation
This project is open source and available under the MIT License.
- FastF1 Documentation: https://docs.fastf1.dev/
- Formula 1 Official: https://www.formula1.com/
- GitHub Repository: https://github.com/lspellman-opsguru/f1-data
- GitHub: @lspellman-opsguru
- Website: https://opsguru.io
- Twitter: @lance_spellman
Happy Racing! 🏁