Parser for loading FIT, TCX and GPX files into Pandas DataFrames.
Project description
activity-parser
Parser for loading FIT, TCX and GPX activity files into Pandas DataFrames.
Provides a parser object for reading (optionally gzipped) FIT, TCX, and GPX activity files and converting them into Pandas DataFrames. During import, column names extracted from activity files are normalized into a canonical set of output column names.
Installation
pip install activity-parser
Usage
Create a new instance of the ActivityParser class to be reused for subsequent parsing of activity files:
import activity_parser
parser = activity_parser.ActivityParser()
Parse FIT, TCX and GPX files into normalized DataFrames:
records, laps, extra = parser.parse('path/to/fit_file.fit')
records, laps, extra = parser.parse('path/to/gpx_file.gpx')
records, laps, extra = parser.parse('path/to/tcx_file.tcx')
Regardless of source format, records and laps use a canonical set of column names (see Output columns below), e.g.:
distance speed cadence heart_rate
time
2026-01-05 08:00:00+00:00 0.00 36.0 80 100
2026-01-05 08:00:01+00:00 0.01 36.0 81 101
extra is not canonicalized like records and laps: it's a dict of leftover, format-specific metadata passed through with its native field names, and its shape differs by format.
For FIT, it's keyed by FIT message name (e.g. session, device_info).
For TCX/GPX, it's a single dict of the root element's attributes/fields (e.g. Creator, Id).
Treat it as raw metadata to inspect per-format rather than something to consume generically.
Output columns
Units are aligned to FIT's standard units (via fitdecode.StandardUnitsDataProcessor), and columns are renamed/converted where needed so the same name means the same unit regardless of source format:
| Column | Unit | FIT | TCX | GPX |
|---|---|---|---|---|
latitude, longitude |
degrees | Yes | Yes | Yes |
altitude |
meters | Yes | Yes | Yes |
distance |
km | Yes | Yes | — |
speed |
km/h | Yes | Yes | (*) |
cadence |
rpm | Yes | Yes | Yes |
heart_rate |
bpm | Yes | Yes | Yes |
power |
watts | Yes | Yes | Yes |
temperature |
°C | Yes | — | Yes |
Not every column appears in every file: parse() only includes columns actually present in the source.
Two of these gaps are structural (GPX has no field for cumulative distance, in the base spec or in Garmin's TrackPointExtension, and TCX has no field for temperature, in the base spec or in Garmin's ActivityExtension), so those will never appear regardless of exporter.
GPX files also have no lap data, so laps will always be an empty DataFrame.
(*) speed for GPX is exporter-dependent, not a format limitation: it's defined in Garmin's TrackPointExtension/v2 schema.
Any exporter that emits v2 (or another extension exposing a speed-named field) will have it picked up and normalized.
laps follows the same convention for shared metrics (total_distance, avg_speed, max_speed, avg_heart_rate, avg_power, total_calories, etc.).
FIT also exposes FIT-specific fields not available from TCX/GPX (e.g. fractional_cadence, left_right_balance, accumulated_power) under their native FIT names.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file activity_parser-0.9.0.tar.gz.
File metadata
- Download URL: activity_parser-0.9.0.tar.gz
- Upload date:
- Size: 18.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7b06bb44c884a7157d980dfdb0a3699edfc40a3b096b1cca8aeb355f2f56a825
|
|
| MD5 |
551f55bb400b45b60a80b3b701def3c4
|
|
| BLAKE2b-256 |
7a4061495483544f4d5306337839562ee0bab5910570ee9fe0928acbfbd1817b
|
Provenance
The following attestation bundles were made for activity_parser-0.9.0.tar.gz:
Publisher:
release.yml on tabishm52/activity_parser
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
activity_parser-0.9.0.tar.gz -
Subject digest:
7b06bb44c884a7157d980dfdb0a3699edfc40a3b096b1cca8aeb355f2f56a825 - Sigstore transparency entry: 2071336688
- Sigstore integration time:
-
Permalink:
tabishm52/activity_parser@8f5d92e9c3d7e6fdfd9901ee1547b3a64e07154b -
Branch / Tag:
refs/tags/v0.9.0 - Owner: https://github.com/tabishm52
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@8f5d92e9c3d7e6fdfd9901ee1547b3a64e07154b -
Trigger Event:
release
-
Statement type:
File details
Details for the file activity_parser-0.9.0-py3-none-any.whl.
File metadata
- Download URL: activity_parser-0.9.0-py3-none-any.whl
- Upload date:
- Size: 10.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0390f97c079ac712e0884441d12d9b134cc23a452bce423ddc071c4490de99e3
|
|
| MD5 |
0ce6f30ce5249517329b6c3912ea5396
|
|
| BLAKE2b-256 |
47d65c2941996f2116742f3ed8fa87712b06bd01147f28e3d892c2cf1746c9cc
|
Provenance
The following attestation bundles were made for activity_parser-0.9.0-py3-none-any.whl:
Publisher:
release.yml on tabishm52/activity_parser
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
activity_parser-0.9.0-py3-none-any.whl -
Subject digest:
0390f97c079ac712e0884441d12d9b134cc23a452bce423ddc071c4490de99e3 - Sigstore transparency entry: 2071336763
- Sigstore integration time:
-
Permalink:
tabishm52/activity_parser@8f5d92e9c3d7e6fdfd9901ee1547b3a64e07154b -
Branch / Tag:
refs/tags/v0.9.0 - Owner: https://github.com/tabishm52
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@8f5d92e9c3d7e6fdfd9901ee1547b3a64e07154b -
Trigger Event:
release
-
Statement type: