fitparserx
A Python library for parsing Garmin .fit files and extracting wellness data (heart rate, stress level, respiration rate) into convenient Python structures (pandas DataFrame, NumPy array). These data are sourced from Garmin Wellness exports: either the daily export (Account Settings > Account Information > Export Wellness Data) or the full archive emailed via the Data Management page. Support for the Garmin activity data will be added in a future release.
Features
Uses Garmin .fit files decoded with the garmin_fit_sdk to:
- Extract proper datetimes and heart rate data.
- Optionally include respiration rate and stress level data.
- Converts the raw data into a pandas DataFrame or a NumPy array.
- Timezone‑aware datetime handling.
- Integrating estimated sleep data.
Installation
- (Optional) Create and activate a virtual environment:
python3 -m venv .venv
source .venv/bin/activate
- Install the package using pip:
pip install fitparserx
Usage
from fitparserx import FitParser
Initialize parser pointing to a directory or single file
Put your data into a data/ file. Otherwise, the parser goes through data in the current working directory. You can also point a path to a specific file.
mode='all' requires email prefix for .fit filenames
parser = FitParser(path="./data", email="user@example.com", mode="all")
DataFrame
Convert to a pandas DataFrame with datetimes and metrics:
# Only heart rate (default)
fit_df = parser.to_dataframe()
# Include stress level and respiration rate, fill missing with NaN
fit_df = parser.to_dataframe(add_metrics=["stress_level", "respiration_rate"], timezone="UTC")
Include the type of activity at each moment (e.g. 'sedentary' or 'walking') using the "add_state" flag:
fit_df = parser.to_dataframe(add_state=True)
Choose a filling strategy for missing data via the fill parameter. By default (fill=None), raw values are retained. If you set fill='NaN', any non-positive entries in "heart_rate", "stress_level" and "respiration_rate" will be replaced with NaN.
fit_df = parser.to_dataframe(fill='NaN')
Sleep Data
After downloading your user data from Data Management, you’ll find your sleep data in JSON files located in the directory DI_CONNECT/DI-Connect-Wellness. To add a Boolean column indicating sleep state (True for sleeping, no_sleep otherwise, defaults to False), call the add_sleep() method on the parser:
parser = FitParser(...)
parser.add_sleep(path="./sleep_data")
To get only the sleep time data, call the method parse_sleep_data():
sleeptimes = parser.parse_sleep_data(path="./sleep_data", timezone=timezone)
Note: parser.timezone is the timezone of the dataframe datetimes; setting option timezone in parse_sleep_data() doesn't change parser.timezone.
NumPy Array
fit_np = parser.to_numpy()
License
MIT License
Metadata
Release files for fitparserx 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| fitparserx-0.1.5.tar.gz | 10.9 kB | Without provenance | Details for fitparserx-0.1.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| fitparserx-0.1.5-py3-none-any.whl | Python 3 | none | any | Details for fitparserx-0.1.5-py3-none-any.whl |
Total release size: 20.9 kB
Release files / fitparserx-0.1.5.tar.gz
| Download URL | fitparserx-0.1.5.tar.gz |
|---|---|
| Size | 10.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ecd2cc81d68a91704f49d04025813206f4ab03e7ed3561c1684636cd2c04f994
|
|
BLAKE2b-256 checksum How to use checksums |
d5bac95d8bd51d04dc4a051f7a7bc6fae9c736147055aee506fc7d1c1ab746a9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.3
|
Release files / fitparserx-0.1.5-py3-none-any.whl
| Download URL | fitparserx-0.1.5-py3-none-any.whl |
|---|---|
| Size | 10.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d65395a8637d66a83a843e6152e4a2c97f65514a412132fee961ce1525bfff60
|
|
BLAKE2b-256 checksum How to use checksums |
16dc068207e2ed6a11209e7666f0e3dc83c859e185a4c29b4b50c57723fa986b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.3
|
Security for fitparserx 0.1.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.