GithubHelp home page GithubHelp logo

aartgoossens / athletic_pandas Goto Github PK

View Code? Open in Web Editor NEW
4.0 2.0 3.0 148 KB

Extension of Pandas that provides workout analysis tools

License: MIT License

Python 99.55% Makefile 0.45%
exercise workouts cycling running data-analysis

athletic_pandas's Introduction

Athletic Pandas


DEPRECATION NOTICE: This library has been deprecated. Code has been moved to sweatpy and development will continue there.

Introduction

Athletic Pandas is an extension of pandas designed to make workout analysis a breeze. The current state of the project is very beta: features might be added, removed or changed in backwards incompatible ways. When the time is right a stable version will be released. Get in touch with me or create an issue if you have problems/questions/feature requests/special use cases.

Installation

This library can be installed via PyPI:

pip install athletic_pandas

Usage

The core feature of this library is the WorkoutDataFrame. This class is a subclass of pandas.DataFrame and offers all the functionality that is available for this class, plus some workout specific functionality.

After installation, the WorkoutDataFrame can be imported this way:

from athletic_pandas.models import WorkoutDataFrame

To load some example data from this repository:

import pandas as pd
wdf = WorkoutDataFrame(pd.read_csv('./tests.example_files/workout_1.csv'))

Basic operations on the data are provided by pandas.Dataframe superclass:

wdf.power.mean()
>> 131.65231973169369
wdf.power.max()
>> 280
wdf.heartrate.plot()

Heartrate plot

For some workout specific functionality information about the athlete is needed. This can be set on the WorkoutDataFrame as follows:

from athletic_pandas.models import Athlete
wdf.athlete = Athlete(name='Chris Froome', cp=175, w_prime=20000)

When this is done for example the W'balance can be computed, added to the wdf and plotted:

wdf = wdf.assign(w_prime_balance=wdf.compute_w_prime_balance())
wdf.w_prime_balance.plot()

W'prime balance plot

It is also possible to compute and plot the mean max power for this workout:

mean_max_power = wdf.compute_mean_max_power()
# Get the mean max power for 60 seconds
mean_max_power[60]
>> 215.03278688524591
mean_max_power.plot()

Mean max power

Another feature of this library is that you can create custom workout and for example analyze the W'balance of it:

wdf = WorkoutDataFrame(dict(
    power=[100]*60 + [200]*120 + [100]*60
))
wdf.athlete = Athlete(cp=175, w_prime=20000)
wdf = wdf.assign(w_prime_balance=wdf.compute_w_prime_balance())
wdf.w_prime_balance_min()
>> 17320.207532891662

There are already more algorithms available on the WorkoutDataFrame such as alternatives for the Skiba W'balance algorithm. More algorithms will be added later.

This documentation is quite compact at the moment but will be extended with more examples in the near future. Stay tuned!

Contributing

Coming soon...

Contributors

Aart Goossens

License

See LICENSE file.

athletic_pandas's People

Contributors

aartgoossens avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

athletic_pandas's Issues

Add Athlete model

Add Athlete that serves as a class attribute for Workout to provide additional data like FTP.

Add CalenderDataFrame

Add model CalenderDataFrame that enables longitudinal analysis of e.g. training load.
Preferably stores WorkoutDataFrame objects in a column called 'data'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.