-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
KeyError when trying to run the script #1
Comments
Hi @finishthepint, thank you for bringing this issue. It appears that one of the underlying packages used in this project, To resolve this, I’ve just released a major update to the project. I’ve replaced the Additionally, I've updated the documentation and added a new "Code Workflow Example" section, including example code to demonstrate the process. I've tested the updated code with a recent Strava export using Python 3.13.1, and everything is working as expected. |
It's reproducible on last commit too. Python 3.13.1, Windows PS: Seems like you made a typo in year at line 2 of script - # Last update: 2024-01-10 |
Hi @anisart, Thank you for reporting this! It seems the error is due to the To troubleshoot, I suggest running these parsing functions independently on your activity files (depending on their format) to verify if they are correctly extracting I've also made some adjustments to the code to better handle the scenario where no latitude/longitude is available. Additionally, thanks for pointing out the typo in the year! |
Thank you for the quick reply! Last change also didn't help me. Exception just transformed to error about no activities without GPS data) After some debugging I found that code stops at fit_file_parse()
Fixed by removing line 13 - globals().clear() gpx_file_parse() works OK and now code stops at tcx_file_parse()
Debugging to be continue... |
In tcx_file_parse() need to add check for coordinates. It brokes on activities from trainer without coordinates |
Hi @anisart, Thank you for the detailed feedback! I have updated the code once again, merging the previously created Please update the code from your side accordingly. Additionally, please note that there is now a new Python package dependency: While importing Let me know if you need any further changes or clarifications. |
I've finally created a heatmap. It was a quite long time for 2020 activities and consumed 2GB RAM at peak. You forgot to add 'import janitor' to strava-local-heatmap-tool.py. And need to update requirements.txt with last changes. One of the difficulties was that I wanted to process the old archive (2019) first. But Strava constantly changes structure of activities.csv. Newer archives already use localized values for fields, types and dates (russian in my case). I'v copied english header from another activities.csv (with english locale) and used dateparser module for parse dates. It might be useful to include this in the readme - switch Strava interface language to English before requesting an archive. |
It seems that one of my
The language requirement ( You can avoid geolocation retrieval for activities in the |
Sorry, I missed it.
I set it to Anyway thank you for this tool! |
Hi @anisart,
No worries.
In the readme file I explained why
The code that enforces this limit is:
Thanks for your feedback - I'm glad you found it useful! |
I'm trying to run the script on my strava data export but running into the following error:
Traceback (most recent call last): File "/home/george/Downloads/strava-local-heatmap-tool-main/strava-local-heatmap-tool.py", line 760, in <module> activities_df = activities_import( ^^^^^^^^^^^^^^^^^^ File "/home/george/Downloads/strava-local-heatmap-tool-main/strava-local-heatmap-tool.py", line 336, in activities_import activities_coordinates_df = activities_coordinates_import( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/george/Downloads/strava-local-heatmap-tool-main/strava-local-heatmap-tool.py", line 198, in activities_coordinates_import activities_coordinates_df = activities_coordinates_df[activities_coordinates_df['latitude'].notna()] ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^ File "/home/george/.local/lib/python3.11/site-packages/pandas/core/frame.py", line 4102, in __getitem__ indexer = self.columns.get_loc(key) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/george/.local/lib/python3.11/site-packages/pandas/core/indexes/range.py", line 417, in get_loc raise KeyError(key) KeyError: 'latitude'
The text was updated successfully, but these errors were encountered: