Skip to content

Instantly share code, notes, and snippets.

View ThonyPrice's full-sized avatar

Thony Price ThonyPrice

View GitHub Profile
@ThonyPrice
ThonyPrice / date-time-index.py
Created April 24, 2019 22:38
Medium - Get started analysing your CGM data
df = df.copy(deep=True)
df['time'] = pd.to_datetime(df['time'])
df['time'] = df['time']\
.dt.tz_localize(tz='UTC')\
.dt.tz_convert('US/Pacific')
df.set_index('time', inplace=True)
df.head()
@ThonyPrice
ThonyPrice / select-df.py
Created April 24, 2019 21:31
Medium - Get started analysing your CGM data
df = df[['Timestamp (YYYY-MM-DDThh:mm:ss)', 'Glucose Value (mg/dL)']]
df.rename(columns={
"Timestamp (YYYY-MM-DDThh:mm:ss)": "time",
"Glucose Value (mg/dL)": "glucose"},
inplace=True)
df.head()
@ThonyPrice
ThonyPrice / trim-df.py
Created April 24, 2019 21:10
Medium - Get started analysing your CGM data
df = df.iloc[10:,:]
df.head()
@ThonyPrice
ThonyPrice / read-data.py
Last active May 30, 2019 19:31
Medium - Get started analysing your CGM data
import pandas as pd
df = pd.read_csv('drive/My Drive/my-cgm-exploration/Example_CGM_data.csv')
df.head(20)
@ThonyPrice
ThonyPrice / access-drive.py
Last active April 24, 2019 19:22
Medium - Get started analysing your CGM data
from google.colab import drive
drive.mount('/content/drive')