Skip to content

Instantly share code, notes, and snippets.

@ThonyPrice
Created April 25, 2019 20:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ThonyPrice/48b07f1ea7712299975062b5450f64a5 to your computer and use it in GitHub Desktop.
Save ThonyPrice/48b07f1ea7712299975062b5450f64a5 to your computer and use it in GitHub Desktop.
Medium - Get started analysing your CGM data
z = df.copy(deep=True)
z['day'] = z.index.date
z['day_time'] = z.index.round('5Min').time
z = z[['day', 'day_time', 'glucose']]
z = z.groupby(['day', 'day_time']).last()
z = z.reset_index()
_ = plt.figure(figsize=(20, 8))
x_cmap = sns.diverging_palette(220, 20, n=9)
f = sns.heatmap(z.pivot('day_time', 'day', 'glucose'), cmap=x_cmap, vmin=0, vmax=300)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment