Open rokesby opened 3 months ago
If you comment out, the pre-processor does run but the Stream visualisation fails as it is expecting these values.
workout_data['duration'] = pd.to_numeric(workout_data['duration'])
# workout_data['totalEnergyBurned'] = pd.to_numeric(workout_data['totalEnergyBurned'])
# workout_data['totalDistance'] = pd.to_numeric(workout_data['totalDistance'])
These attributes might not be present in the latest export.xml files due to deprecation:
We may need to get these attributes using a more up to date method.
(patricks_venv) ➜ patricks-workouts git:(main) ✗ python workout_preprocessor.py Do workout preprocessing...
Traceback (most recent call last): File "/Users/reza/Code/patricks-workouts/patricks_venv/lib/python3.12/site-packages/pandas/core/indexes/base.py", line 3805, in get_loc return self._engine.get_loc(casted_key) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "index.pyx", line 167, in pandas._libs.index.IndexEngine.get_loc File "index.pyx", line 196, in pandas._libs.index.IndexEngine.get_loc File "pandas/_libs/hashtable_class_helper.pxi", line 7081, in pandas._libs.hashtable.PyObjectHashTable.get_item File "pandas/_libs/hashtable_class_helper.pxi", line 7089, in pandas._libs.hashtable.PyObjectHashTable.get_item KeyError: 'totalEnergyBurned'
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "/Users/reza/Code/patricks-workouts/workout_preprocessor.py", line 87, in
create_and_save_optimized_file("./workouts.pickle", "./temp/apple_health_export/Export.xml")
File "/Users/reza/Code/patricks-workouts/workout_preprocessor.py", line 62, in create_and_save_optimized_file
workout_data['totalEnergyBurned'] = pd.to_numeric(workout_data['totalEnergyBurned'])