How can I convert a FIT file (Garmim) at CSV file? I built this structure and some of the data is wrong, how can I fix it?
import fitparse
import pandas as pd
fitfile = fitparse.FitFile("#MyPath")
fitfile.parse()
all_data = []
for record in fitfile.get_messages('record'):
record_dict = {'timestamp': record.get_value('timestamp')}
for record_data in record:
if record_data.units:
record_dict[record_data.name] = f"{record_data.value} {record_data.units}"
else:
record_dict[record_data.name] = record_data.value
all_data.append(record_dict)
df = pd.DataFrame(all_data)
df.to_csv('output.csv', index=False)