diff --git a/strava/README.md b/strava/README.md index b9497da..441842f 100644 --- a/strava/README.md +++ b/strava/README.md @@ -2,6 +2,4 @@ Strava Integration README * Login into Strava * Copy your Access Token from https://www.strava.com/settings/api -* Clone credentials-sample.json as credentials.json -* Copy your access token into credentials.json and save * Run strava_downloader.ipynb \ No newline at end of file diff --git a/strava/strava_downloader2.ipynb b/strava/strava_downloader2.ipynb new file mode 100644 index 0000000..3b95c57 --- /dev/null +++ b/strava/strava_downloader2.ipynb @@ -0,0 +1,1025 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Strava Activities Downloader\n", + "\n", + "Download all of your Strava Activites and Export to CSV\n", + "\n", + "SEE: strava_data_analysis.ipynb for Strava Data Analysis and Data Visualization of Running, Cycling and Other Activities" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "References:\n", + "\n", + "* https://developers.strava.com/docs/\n", + "\n", + "* https://github.com/sladkovm/stravaio\n", + "\n", + "\n", + "\n", + "Contributions:\n", + "\n", + "* Kristoffer J. Zieba (https://github.com/kriszieba)\n", + "\n", + "* Contributors of StravaIO (https://github.com/sladkovm/stravaio)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## 1. Import required libraries" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "import os # will be used for reading environment variables\n", + "from stravaio import StravaIO, strava_oauth2 # will be used for accessing Strava data\n", + "import pandas as pd # if you know this, you are qualified at least for the data analitics job \n", + "import numpy as np # the mother of all data processing in Python\n", + "import datetime # decoding of time info\n", + "from dateutil.tz import tzutc # decoding of time info" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## 2. Load Strava Data" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "To access your strava data programmatically you will need an **access token**. Strava recently changed their policy and accessing a token with activity level permission become a bit cumbersome. For such cases I've created a project that allows to lounch a local server to get the personal token. Go to the [strava-oauth](https://github.com/sladkovm/strava-oauth) for more info." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "To access the strava data you need a *stravaio* library. It's purpose is to be as declarative as possible and the user should never have a feeling that he is working with a web service. In the center of the *stravaio* workflow is the *StravaIO* object that exposes all required functions to access *athlete*, *activities* and *streams* data." + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "2020-08-26 16:34:00.016 | INFO | stravaio:strava_oauth2:343 - serving at port 8000\n", + "2020-08-26 16:34:02.771 | DEBUG | stravaio:run_server_and_wait_for_token:397 - code: 6c3fe70011648fe076106d23b7fc1fbeefb0725a\n", + "2020-08-26 16:34:03.338 | DEBUG | stravaio:run_server_and_wait_for_token:406 - Authorized athlete: 83758d7707e4c7cf3b057faedb4e2bedb8044f35\n" + ] + } + ], + "source": [ + "access_token = strava_oauth2(client_id=NNNNN, client_secret='XXXXXXX') # Replace Ns and Xs by real values" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "client = StravaIO(access_token=access_token['access_token'])" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "StravaIO object directly exposes [Strava Swagger API interfaces](https://developers.strava.com/docs/reference/)" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'configuration': ,\n", + " '_api_client': ,\n", + " 'athletes_api': ,\n", + " 'activities_api': ,\n", + " 'streams_api': }" + ] + }, + "execution_count": 4, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "client.__dict__" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The StravaIO exposes a number of methods that allow direct access to Strava data (essentially these are the wrappers around the api interfaces that simplify life)" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "activities_api\n", + "athletes_api\n", + "configuration\n", + "get_activity_by_id\n", + "get_activity_streams\n", + "get_logged_in_athlete\n", + "get_logged_in_athlete_activities\n", + "local_activities\n", + "local_athletes\n", + "local_streams\n", + "streams_api\n" + ] + } + ], + "source": [ + "for m in dir(client):\n", + " if not m.startswith('_'):\n", + " print(m)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Get athlete information\n", + "Only information about the logged in athlete could be accessed. The access_token unambiguosly encodes the information about the athlete." + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [], + "source": [ + "import os\n", + "#import dotenv\n", + "import warnings\n", + "\n", + "athlete = client.get_logged_in_athlete()" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "Name: Kristoffer Jan, \n", + "Last Name: Zieba, \n", + "FTP: 300, \n", + "\n" + ] + } + ], + "source": [ + "print(f\"\"\"\n", + "Name: {athlete.api_response.firstname}, \n", + "Last Name: {athlete.api_response.lastname}, \n", + "FTP: {athlete.api_response.ftp}, \n", + "\"\"\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Get the athletes activities\n", + "\n", + "The *after* parameter takes the date in human readable format - you can even tell it \"Last year\". The function returns a list of SummaryActivity." + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Fetched 18, the latests is on 2020-08-22 12:41:46+00:00\n" + ] + } + ], + "source": [ + "activities = client.get_logged_in_athlete_activities(after='last month')" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "swagger_client.models.summary_activity.SummaryActivity" + ] + }, + "execution_count": 9, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "type(activities[0])" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# 3. Make a local copy of training data" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "scrolled": false + }, + "outputs": [], + "source": [ + "data = [] #local copy of downloaded activities\n", + "for a in activities:\n", + " data.append(a)" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "list" + ] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "type(data)" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": {}, + "outputs": [], + "source": [ + "# Reassigning in order to be able to make dataframe out of\n", + "txt = str(data)\n", + "lst = eval(txt)" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": {}, + "outputs": [], + "source": [ + "df = pd.DataFrame(lst)\n", + "df = df.set_index(\"start_date_local\")" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
achievement_countathleteathlete_countaverage_speedaverage_wattscomment_countcommutedevice_wattsdistanceelapsed_time...start_datestart_latlngtimezonetotal_elevation_gaintotal_photo_counttrainertypeupload_idweighted_average_wattsworkout_type
start_date_local
2020-07-27 17:09:54+00:009{'id': 1010749}17.552196.60FalseTrue58156.08565...2020-07-27 15:09:54+00:00[63.43, 10.35](GMT+01:00) Europe/Oslo1014.00FalseRide4087852343244.0NaN
2020-07-28 20:38:56+00:0012{'id': 1010749}17.656182.70FalseFalse17670.02335...2020-07-28 18:38:56+00:00[63.43, 10.35](GMT+01:00) Europe/Oslo228.00FalseRide4095779077NaNNaN
2020-07-29 16:32:42+00:0014{'id': 1010749}18.055191.30FalseTrue81100.010227...2020-07-29 14:32:42+00:00[63.43, 10.35](GMT+01:00) Europe/Oslo930.00FalseRide4101312337214.0NaN
2020-07-31 15:49:32+00:009{'id': 1010749}18.483186.80FalseFalse37570.47911...2020-07-31 13:49:32+00:00[63.43, 10.35](GMT+01:00) Europe/Oslo307.00FalseRide4112490263NaNNaN
2020-08-01 12:18:42+00:0018{'id': 1010749}17.959194.30FalseTrue104618.013864...2020-08-01 10:18:42+00:00[63.43, 10.35](GMT+01:00) Europe/Oslo1299.02FalseRide4117730459212.010.0
2020-08-04 17:28:28+00:000{'id': 1010749}18.143167.00FalseFalse23746.24334...2020-08-04 15:28:28+00:00[63.43, 10.34](GMT+01:00) Europe/Oslo215.00FalseRide4134832264NaNNaN
2020-08-04 18:46:26+00:0014{'id': 1010749}1110.877324.63FalseFalse29183.52683...2020-08-04 16:46:26+00:00[63.33, 10.3](GMT+01:00) Europe/Oslo238.02FalseRide4134830886NaN11.0
2020-08-04 19:50:29+00:002{'id': 1010749}36.769147.90FalseFalse15575.82450...2020-08-04 17:50:29+00:00[63.33, 10.3](GMT+01:00) Europe/Oslo237.00FalseRide4135139826NaNNaN
2020-08-05 08:19:52+00:000{'id': 1010749}16.891158.90FalseTrue34050.94991...2020-08-05 06:19:52+00:00[63.43, 10.35](GMT+01:00) Europe/Oslo419.00FalseRide4137786561175.0NaN
2020-08-07 11:54:47+00:0042{'id': 1010749}17.499187.70FalseTrue121131.018587...2020-08-07 09:54:47+00:00[63.2, 9.77](GMT+01:00) Europe/Oslo1624.03FalseRide4150962314213.010.0
2020-08-09 13:39:22+00:005{'id': 1010749}17.015180.20FalseTrue76017.412886...2020-08-09 11:39:22+00:00[63.43, 10.35](GMT+01:00) Europe/Oslo1459.00FalseRide4161467128214.0NaN
2020-08-10 19:06:25+00:002{'id': 1010749}17.508178.80FalseTrue48388.96483...2020-08-10 17:06:25+00:00[63.43, 10.35](GMT+01:00) Europe/Oslo636.00FalseRide4167460174193.0NaN
2020-08-13 15:41:29+00:001{'id': 1010749}16.773210.60FalseTrue22234.83354...2020-08-13 13:41:29+00:00[63.43, 10.35](GMT+01:00) Europe/Oslo603.00FalseRide4182156851261.0NaN
2020-08-16 14:46:00+00:0024{'id': 1010749}16.970177.20FalseTrue66575.09623...2020-08-16 12:46:00+00:00[63.43, 10.35](GMT+01:00) Europe/Oslo1261.00FalseRide4198429443203.0NaN
2020-08-18 14:36:48+00:0016{'id': 1010749}17.934182.40FalseTrue133116.017955...2020-08-18 12:36:48+00:00[63.43, 10.35](GMT+01:00) Europe/Oslo1518.01FalseRide4209135474196.010.0
2020-08-20 19:37:27+00:002{'id': 1010749}16.501144.90FalseTrue28447.94487...2020-08-20 17:37:27+00:00[63.43, 10.35](GMT+01:00) Europe/Oslo362.00FalseRide4219861862160.0NaN
2020-08-21 19:00:33+00:003{'id': 1010749}16.963200.10FalseTrue30421.84472...2020-08-21 17:00:33+00:00[63.43, 10.34](GMT+01:00) Europe/Oslo755.00FalseRide4224297873257.0NaN
2020-08-22 14:41:46+00:003{'id': 1010749}16.864161.60FalseTrue60792.39375...2020-08-22 12:41:46+00:00[63.43, 10.35](GMT+01:00) Europe/Oslo899.01FalseRide4228381002177.010.0
\n", + "

18 rows × 38 columns

\n", + "
" + ], + "text/plain": [ + " achievement_count athlete athlete_count \\\n", + "start_date_local \n", + "2020-07-27 17:09:54+00:00 9 {'id': 1010749} 1 \n", + "2020-07-28 20:38:56+00:00 12 {'id': 1010749} 1 \n", + "2020-07-29 16:32:42+00:00 14 {'id': 1010749} 1 \n", + "2020-07-31 15:49:32+00:00 9 {'id': 1010749} 1 \n", + "2020-08-01 12:18:42+00:00 18 {'id': 1010749} 1 \n", + "2020-08-04 17:28:28+00:00 0 {'id': 1010749} 1 \n", + "2020-08-04 18:46:26+00:00 14 {'id': 1010749} 11 \n", + "2020-08-04 19:50:29+00:00 2 {'id': 1010749} 3 \n", + "2020-08-05 08:19:52+00:00 0 {'id': 1010749} 1 \n", + "2020-08-07 11:54:47+00:00 42 {'id': 1010749} 1 \n", + "2020-08-09 13:39:22+00:00 5 {'id': 1010749} 1 \n", + "2020-08-10 19:06:25+00:00 2 {'id': 1010749} 1 \n", + "2020-08-13 15:41:29+00:00 1 {'id': 1010749} 1 \n", + "2020-08-16 14:46:00+00:00 24 {'id': 1010749} 1 \n", + "2020-08-18 14:36:48+00:00 16 {'id': 1010749} 1 \n", + "2020-08-20 19:37:27+00:00 2 {'id': 1010749} 1 \n", + "2020-08-21 19:00:33+00:00 3 {'id': 1010749} 1 \n", + "2020-08-22 14:41:46+00:00 3 {'id': 1010749} 1 \n", + "\n", + " average_speed average_watts comment_count \\\n", + "start_date_local \n", + "2020-07-27 17:09:54+00:00 7.552 196.6 0 \n", + "2020-07-28 20:38:56+00:00 7.656 182.7 0 \n", + "2020-07-29 16:32:42+00:00 8.055 191.3 0 \n", + "2020-07-31 15:49:32+00:00 8.483 186.8 0 \n", + "2020-08-01 12:18:42+00:00 7.959 194.3 0 \n", + "2020-08-04 17:28:28+00:00 8.143 167.0 0 \n", + "2020-08-04 18:46:26+00:00 10.877 324.6 3 \n", + "2020-08-04 19:50:29+00:00 6.769 147.9 0 \n", + "2020-08-05 08:19:52+00:00 6.891 158.9 0 \n", + "2020-08-07 11:54:47+00:00 7.499 187.7 0 \n", + "2020-08-09 13:39:22+00:00 7.015 180.2 0 \n", + "2020-08-10 19:06:25+00:00 7.508 178.8 0 \n", + "2020-08-13 15:41:29+00:00 6.773 210.6 0 \n", + "2020-08-16 14:46:00+00:00 6.970 177.2 0 \n", + "2020-08-18 14:36:48+00:00 7.934 182.4 0 \n", + "2020-08-20 19:37:27+00:00 6.501 144.9 0 \n", + "2020-08-21 19:00:33+00:00 6.963 200.1 0 \n", + "2020-08-22 14:41:46+00:00 6.864 161.6 0 \n", + "\n", + " commute device_watts distance elapsed_time ... \\\n", + "start_date_local ... \n", + "2020-07-27 17:09:54+00:00 False True 58156.0 8565 ... \n", + "2020-07-28 20:38:56+00:00 False False 17670.0 2335 ... \n", + "2020-07-29 16:32:42+00:00 False True 81100.0 10227 ... \n", + "2020-07-31 15:49:32+00:00 False False 37570.4 7911 ... \n", + "2020-08-01 12:18:42+00:00 False True 104618.0 13864 ... \n", + "2020-08-04 17:28:28+00:00 False False 23746.2 4334 ... \n", + "2020-08-04 18:46:26+00:00 False False 29183.5 2683 ... \n", + "2020-08-04 19:50:29+00:00 False False 15575.8 2450 ... \n", + "2020-08-05 08:19:52+00:00 False True 34050.9 4991 ... \n", + "2020-08-07 11:54:47+00:00 False True 121131.0 18587 ... \n", + "2020-08-09 13:39:22+00:00 False True 76017.4 12886 ... \n", + "2020-08-10 19:06:25+00:00 False True 48388.9 6483 ... \n", + "2020-08-13 15:41:29+00:00 False True 22234.8 3354 ... \n", + "2020-08-16 14:46:00+00:00 False True 66575.0 9623 ... \n", + "2020-08-18 14:36:48+00:00 False True 133116.0 17955 ... \n", + "2020-08-20 19:37:27+00:00 False True 28447.9 4487 ... \n", + "2020-08-21 19:00:33+00:00 False True 30421.8 4472 ... \n", + "2020-08-22 14:41:46+00:00 False True 60792.3 9375 ... \n", + "\n", + " start_date start_latlng \\\n", + "start_date_local \n", + "2020-07-27 17:09:54+00:00 2020-07-27 15:09:54+00:00 [63.43, 10.35] \n", + "2020-07-28 20:38:56+00:00 2020-07-28 18:38:56+00:00 [63.43, 10.35] \n", + "2020-07-29 16:32:42+00:00 2020-07-29 14:32:42+00:00 [63.43, 10.35] \n", + "2020-07-31 15:49:32+00:00 2020-07-31 13:49:32+00:00 [63.43, 10.35] \n", + "2020-08-01 12:18:42+00:00 2020-08-01 10:18:42+00:00 [63.43, 10.35] \n", + "2020-08-04 17:28:28+00:00 2020-08-04 15:28:28+00:00 [63.43, 10.34] \n", + "2020-08-04 18:46:26+00:00 2020-08-04 16:46:26+00:00 [63.33, 10.3] \n", + "2020-08-04 19:50:29+00:00 2020-08-04 17:50:29+00:00 [63.33, 10.3] \n", + "2020-08-05 08:19:52+00:00 2020-08-05 06:19:52+00:00 [63.43, 10.35] \n", + "2020-08-07 11:54:47+00:00 2020-08-07 09:54:47+00:00 [63.2, 9.77] \n", + "2020-08-09 13:39:22+00:00 2020-08-09 11:39:22+00:00 [63.43, 10.35] \n", + "2020-08-10 19:06:25+00:00 2020-08-10 17:06:25+00:00 [63.43, 10.35] \n", + "2020-08-13 15:41:29+00:00 2020-08-13 13:41:29+00:00 [63.43, 10.35] \n", + "2020-08-16 14:46:00+00:00 2020-08-16 12:46:00+00:00 [63.43, 10.35] \n", + "2020-08-18 14:36:48+00:00 2020-08-18 12:36:48+00:00 [63.43, 10.35] \n", + "2020-08-20 19:37:27+00:00 2020-08-20 17:37:27+00:00 [63.43, 10.35] \n", + "2020-08-21 19:00:33+00:00 2020-08-21 17:00:33+00:00 [63.43, 10.34] \n", + "2020-08-22 14:41:46+00:00 2020-08-22 12:41:46+00:00 [63.43, 10.35] \n", + "\n", + " timezone total_elevation_gain \\\n", + "start_date_local \n", + "2020-07-27 17:09:54+00:00 (GMT+01:00) Europe/Oslo 1014.0 \n", + "2020-07-28 20:38:56+00:00 (GMT+01:00) Europe/Oslo 228.0 \n", + "2020-07-29 16:32:42+00:00 (GMT+01:00) Europe/Oslo 930.0 \n", + "2020-07-31 15:49:32+00:00 (GMT+01:00) Europe/Oslo 307.0 \n", + "2020-08-01 12:18:42+00:00 (GMT+01:00) Europe/Oslo 1299.0 \n", + "2020-08-04 17:28:28+00:00 (GMT+01:00) Europe/Oslo 215.0 \n", + "2020-08-04 18:46:26+00:00 (GMT+01:00) Europe/Oslo 238.0 \n", + "2020-08-04 19:50:29+00:00 (GMT+01:00) Europe/Oslo 237.0 \n", + "2020-08-05 08:19:52+00:00 (GMT+01:00) Europe/Oslo 419.0 \n", + "2020-08-07 11:54:47+00:00 (GMT+01:00) Europe/Oslo 1624.0 \n", + "2020-08-09 13:39:22+00:00 (GMT+01:00) Europe/Oslo 1459.0 \n", + "2020-08-10 19:06:25+00:00 (GMT+01:00) Europe/Oslo 636.0 \n", + "2020-08-13 15:41:29+00:00 (GMT+01:00) Europe/Oslo 603.0 \n", + "2020-08-16 14:46:00+00:00 (GMT+01:00) Europe/Oslo 1261.0 \n", + "2020-08-18 14:36:48+00:00 (GMT+01:00) Europe/Oslo 1518.0 \n", + "2020-08-20 19:37:27+00:00 (GMT+01:00) Europe/Oslo 362.0 \n", + "2020-08-21 19:00:33+00:00 (GMT+01:00) Europe/Oslo 755.0 \n", + "2020-08-22 14:41:46+00:00 (GMT+01:00) Europe/Oslo 899.0 \n", + "\n", + " total_photo_count trainer type upload_id \\\n", + "start_date_local \n", + "2020-07-27 17:09:54+00:00 0 False Ride 4087852343 \n", + "2020-07-28 20:38:56+00:00 0 False Ride 4095779077 \n", + "2020-07-29 16:32:42+00:00 0 False Ride 4101312337 \n", + "2020-07-31 15:49:32+00:00 0 False Ride 4112490263 \n", + "2020-08-01 12:18:42+00:00 2 False Ride 4117730459 \n", + "2020-08-04 17:28:28+00:00 0 False Ride 4134832264 \n", + "2020-08-04 18:46:26+00:00 2 False Ride 4134830886 \n", + "2020-08-04 19:50:29+00:00 0 False Ride 4135139826 \n", + "2020-08-05 08:19:52+00:00 0 False Ride 4137786561 \n", + "2020-08-07 11:54:47+00:00 3 False Ride 4150962314 \n", + "2020-08-09 13:39:22+00:00 0 False Ride 4161467128 \n", + "2020-08-10 19:06:25+00:00 0 False Ride 4167460174 \n", + "2020-08-13 15:41:29+00:00 0 False Ride 4182156851 \n", + "2020-08-16 14:46:00+00:00 0 False Ride 4198429443 \n", + "2020-08-18 14:36:48+00:00 1 False Ride 4209135474 \n", + "2020-08-20 19:37:27+00:00 0 False Ride 4219861862 \n", + "2020-08-21 19:00:33+00:00 0 False Ride 4224297873 \n", + "2020-08-22 14:41:46+00:00 1 False Ride 4228381002 \n", + "\n", + " weighted_average_watts workout_type \n", + "start_date_local \n", + "2020-07-27 17:09:54+00:00 244.0 NaN \n", + "2020-07-28 20:38:56+00:00 NaN NaN \n", + "2020-07-29 16:32:42+00:00 214.0 NaN \n", + "2020-07-31 15:49:32+00:00 NaN NaN \n", + "2020-08-01 12:18:42+00:00 212.0 10.0 \n", + "2020-08-04 17:28:28+00:00 NaN NaN \n", + "2020-08-04 18:46:26+00:00 NaN 11.0 \n", + "2020-08-04 19:50:29+00:00 NaN NaN \n", + "2020-08-05 08:19:52+00:00 175.0 NaN \n", + "2020-08-07 11:54:47+00:00 213.0 10.0 \n", + "2020-08-09 13:39:22+00:00 214.0 NaN \n", + "2020-08-10 19:06:25+00:00 193.0 NaN \n", + "2020-08-13 15:41:29+00:00 261.0 NaN \n", + "2020-08-16 14:46:00+00:00 203.0 NaN \n", + "2020-08-18 14:36:48+00:00 196.0 10.0 \n", + "2020-08-20 19:37:27+00:00 160.0 NaN \n", + "2020-08-21 19:00:33+00:00 257.0 NaN \n", + "2020-08-22 14:41:46+00:00 177.0 10.0 \n", + "\n", + "[18 rows x 38 columns]" + ] + }, + "execution_count": 14, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": {}, + "outputs": [], + "source": [ + "df.to_csv('data/strava-activities-raw.csv')" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.7.4" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +}