This current state of the project is early beta, which means that features can be added, removed or changed in backwards incompatible ways.

We published this minor release with some bug fixes , new Python and Pandas releases support and Strava Client Authentication. In this release of RunPandas 0.5.2, we include:

  • CI now updated to include build tests with Python 3.9 and Python 3.10. It removed 3.6 Python official support.
  • CI now updated to include build tests with Pandas version 1.4.2 .
  • Strava comes with social client authentication tool integrated. Thanks to contributor @bitner !
  • Fixes on Test suite and read the docs build suite.

What is Runpandas?

Runpandas is a python package based on pandas data analysis library, that makes it easier to perform data analysis from your running sessions stored at tracking files from cellphones and GPS smartwatches or social sports applications such as Strava, MapMyRUn, NikeRunClub, etc. It is designed to enable reading, transforming and running metrics analytics from several tracking files and apps.

Main Features

In order to download the Strava activities, you must authenticate your dev app through Strava servers in order to get a valid access token. Previously, this task had to be performed outside runpandas. Now Runpandas is powered with this handful tool, so you can easily can get the access token and store it locally , so you can use it as long as it doesn't expire it.

Screenshot from the Strava Authentication Authorization WebSite

How does it work ?

We load the environment variables from our terminal or use a .env file with the STRAVA social app personal access tokens. You can create your own using the link instructions here: https://developers.strava.com/

%load_ext autoreload
%autoreload 2
import warnings
warnings.filterwarnings('ignore')

import runpandas
import os
import pandas as pd
pd.set_option('display.max_rows', 500)
from dotenv import load_dotenv
load_dotenv()
True

Firstly, import the runpandas StravaClient, create a Client instance, and read in the client ID and secret loaded previously. Next the one time authentication. The command client.authenticate_web will open a browser with a URL for the athlete to use to approve access to their data from the app.

The athlete is then prompted to log in to the Strava website and give consent to the requesting application. Once the user authorizes, it will store the access token and refresh token. From this point this access token, which lasts for 6 hours, will be what you need to access data. The client also save it locally so it can be re-read and refreshed as needed.

client = runpandas.StravaClient()
client.authenticate_web()
problems on reading token.json file. It considers an empty file.
{'access_token': 'e728378922ebe5e07371904c83771d18a716864f',
 'refresh_token': '59c8537628a19d70330e5aca2ec5a558023a2c03',
 'expires_at': 1660964653}

As shown above, the activity now after loaded can be analysed as any other activity in runpandas!

activity = runpandas.read_strava('7329257123')
activity.summary()
Unable to set attribute media_type on entity <ActivityPhotoPrimary id=None>
Session                           Running: 18-06-2022 07:08:07
Total distance (meters)                                21389.8
Total ellapsed time                            0 days 02:02:20
Total moving time                              0 days 02:02:19
Average speed (km/h)                                       NaN
Average moving speed (km/h)                                NaN
Average pace (per 1 km)                                    NaN
Average pace moving (per 1 km)                             NaN
Average cadence                                        87.7889
Average moving cadence                                  87.847
Average heart rate                                     155.674
Average moving heart rate                              155.713
Average temperature                                        NaN
dtype: object

What is coming next ?

The next releases will focus on supporting marathon results and some plots support. It will be awesome, keep tunned!

Sorry

Sorry for the long delay since the last release, I was kept busy working on other projects. But I will be more frequent here updating our favorite data running sports package!

Thanks

We are constantly developing Runpandas improving its existing features and adding new ones. We will be glad to hear from you about what you like or don’t like, what features you may wish to see in upcoming releases. Please feel free to contact us.