Have you confirmed that the MAGE calculation is working as expected? Maybe my data format is wrong, but it seems like the use of "k" to index the data here is not correct. Shouldn't it be df['Time'][peaks[I]]?
for i in range(len(peaks)):
excursion_points.loc[k] = [peaks[i]] + [df['Time'][k]] + [df['Glucose'][k]] + ["P"]
k+=1
Also, I'm confused by the use of stdev here:
for i in range(stdev,len(excursion_points.Index)-stdev):
Have you confirmed that the MAGE calculation is working as expected? Maybe my data format is wrong, but it seems like the use of "k" to index the data here is not correct. Shouldn't it be df['Time'][peaks[I]]?
Also, I'm confused by the use of stdev here:
for i in range(stdev,len(excursion_points.Index)-stdev):