Skip to main content

Parse Garmin .fit wellness data, process it, and make DataFrame and NumPy arrays

Project description

fitparserx library

A lightweight 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 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.

Installation

  1. (Optional) Create and activate a virtual environment:
python3 -m venv .venv
source .venv/bin/activate
  1. 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=np.nan, any non-positive entries in "heart_rate", "stress_level" and "respiration_rate" will be replaced with np.nan.

fit_df = parser.to_dataframe(fill=np.nan)

NumPy Array

fit_np = parser.to_numpy()

License

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fitparserx-0.1.4.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fitparserx-0.1.4-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file fitparserx-0.1.4.tar.gz.

File metadata

  • Download URL: fitparserx-0.1.4.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for fitparserx-0.1.4.tar.gz
Algorithm Hash digest
SHA256 b945d56b0f6e0d0ddea487aa50e7d81858d0fca3370413cf24b86d1664a4297a
MD5 412bce8e7ebdc6b52e3db137efcd2208
BLAKE2b-256 5184f06f8a9a6b9ab665e5f7f665511104833ec3c22f2e635106e9f11cd3a98e

See more details on using hashes here.

File details

Details for the file fitparserx-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: fitparserx-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for fitparserx-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 c6219c182b29fe99c21edb7998e32bbc792025b072a870bb92815dff0fd35354
MD5 7f44bcd9a6030acf358751511dc5d0bc
BLAKE2b-256 0e42064a7b4455703545278f100a5a01cede4a830cd6a2c2c523de10e45bedfe

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page