Export to CSV
The simplest way to export data for use in Excel, Google Sheets, or other tools.On pandas, the laps frame carries a leading
index column from the source data. to_csv(index=False)
writes it as a normal column. Drop it with laps.drop(columns="index") when it is not needed.Export to Parquet
Parquet is a columnar storage format. It is more efficient than CSV for large datasets. On the pandas backend,to_parquet uses pyarrow, which pip install tif1 installs. The polars backend writes Parquet natively with write_parquet; see Working with Polars Backend.
Export to JSON
For web applications or APIs. Passdate_format="iso" so that timedelta columns such as
LapTime are written as ISO strings. The default epoch format is deprecated in pandas 3.
Export to Excel
Create Excel files with multiple sheets.This section requires the optional Excel engine. Install it with
pip install openpyxl.LapTime as fractions of a day.
Use the float LapTimeSeconds column for lap times in seconds.
Export to SQL Database
Store data in a relational database for complex queries.SQLite treats column names as case-insensitive. The laps DataFrame contains both
Team and team source columns. Drop the duplicate before the SQL write.
SQL databases have no timedelta type. pandas writes timedelta columns as integer
nanoseconds and shows a warning. Convert them to float seconds before the write.Export to PostgreSQL
For production databases.This section requires the optional SQL toolkit and a PostgreSQL driver.
Install them with
pip install sqlalchemy psycopg2-binary. The postgresql+psycopg2:// URL selects that driver.Export for Machine Learning
Prepare data for ML frameworks.NumPy Arrays
Convert timedelta columns to float seconds first. ML frameworks expect numeric arrays. Cast the booleanBrake channel to float so that the array is numeric.
HDF5 Format
Efficient for large numerical datasets.This section requires the optional HDF5 engine. Install it with
pip install tables.Export for Data Visualization Tools
Tableau / Power BI
Export to formats these tools can read.Plotly Dash / Streamlit
Export to JSON for web dashboards.Batch Export Multiple Sessions
Export an entire race weekend or season.Export Entire Season
Working with Polars Backend
The polars backend gives additional export options.Export Telemetry for All Drivers
Efficiently export telemetry for multiple drivers.Best Practices
Use Parquet
A race laps table is roughly 3-4x smaller as Parquet than as CSV, and faster to read/write.
Batch Operations
Use async loading and batch exports for multiple sessions.
Compression
pandas compresses Parquet with snappy by default. Use zstd or gzip for smaller files.
Type Preservation
Parquet preserves timedelta and categorical columns. CSV writes them as text.
Related Pages
Examples
Export examples.
Common Use Cases
Handle big data.