## # In[3]: get_ipython().run_line_magic('matplotlib', 'inline') plt.style.use('seaborn') plt.rcParams['figure.figsize'] = (15, 8) # In[11]: get_ipython().system('ls interpolated/ | grep 05-20 | grep 9-06') # In[151]: data = import_csv( "interpolated/NG1988812H_Maganna_Gustavo_(27-05-20)_(9-06-20)_interpolated.csv" ) # In[68]: data.columns # In[194]: deltas = [1, 15, 30, 60, 120] woo = pd.DataFrame() woo # In[179]:
!ls | grep py from preproc import import_csv x = import_csv("data_test/NG1988812H_Maganna_Gustavo_13-02-20_6-05-20.csv") x type(x.index) set(x["New Device Time"]) x["New Device Time"].unique x["New Device Time"].unique() x = import_csv("data_test/NG1988812H_Maganna_Gustavo_13-02-20_6-05-20.csv") x[x.columns[31]] x[x.columns[31]].unique() x.columns[31] x[x.columns[36]].unique() x.columns[36] x[x.columns[41]].unique() x.columns[41] x x["Sensor Glucose (mg/dL)"] y = pd.DataFrame({"x": range(35)}) y y = pd.DataFrame({"x": range(1,36)}) y.diff(2) y.diff(10) x x['Sensor Glucose (mg/dL)'] x['Sensor Glucose (mg/dL)'].plot() plt.show() plt.style.use("seaborn") plt.show() x['Sensor Glucose (mg/dL)'].plot(); plt.show() x.loc["2020-03-03", 'Sensor Glucose (mg/dL)'].plot(); plt.show()
# Plotting : import matplotlib.pyplot as plt import seaborn as sns # Local : from preproc import time_indexed_df, import_csv from Utils import comparative_hba1c_plot, proportions_visualiser, dist_plot # Debugging only, remove after building : get_ipython().run_line_magic('matplotlib', 'inline') plt.style.use('seaborn') plt.rcParams['figure.figsize'] = (15, 8) # In[9]: cgm_data = import_csv("preprocessed/CareLink-19-apr-2020-3-months.csv") # In[2]: data = pd.read_csv("mySugr_data/Export.csv") data.columns # In[3]: # Date-time indexing : x = data.copy() x["DateTime"] = x["Date"] + " " + x["Time"] x.drop(["Date", "Time"], axis=1, inplace=True) y = time_indexed_df(x, 'DateTime') y.index = y.index.map(lambda t: t.replace(second=0))
## # In[3]: random_seed = 123456 # In[4]: get_ipython().run_line_magic('matplotlib', 'inline') plt.style.use('seaborn') plt.rcParams['figure.figsize'] = (16, 10) plt.rcParams['figure.max_open_warning'] = False # In[5]: data = import_csv("preprocessed/CareLink-23-apr-2020-1-month.csv") # In[6]: print("start \t:", data.index[0]) print("end \t:", data.index[-1]) # In[7]: latest = data.loc["2020-04-19":"2020-04-23", :] # In[8]: #help(pd.plotting.autocorrelation_plot) # In[9]:
from preproc import import_csv x = import_csv("data_test/NG1988812H_Maganna_Gustavo_(13-02-20)_(6-05-20).csv") plt.style.use("seaborn") d = { "resampled": x.loc["2020-04-03", 'Sensor Glucose (mg/dL)'].resample("1T").interpolate(), "interpolated": x.loc["2020-04-03", 'Sensor Glucose (mg/dL)'].interpolate(), "original": x.loc["2020-04-03", 'Sensor Glucose (mg/dL)'] } #labeledplot = lambda obj, label: obj.plot(**{"label": f"{label}"}) #for label, obj in d.items(): # labeledplot(obj, label) d["resampled"].plot(label="glycaemia") d["resampled"].diff(30).plot(label="30 min") d["resampled"].diff(120).plot(label="2 hours") plt.legend() plt.show()