Last update: 18.06.2020 17:06:41
# Sample code generated by DasData www.DasData.co import requests import pandas as pd import matplotlib.pyplot as plt plt.style.use('seaborn-whitegrid') import numpy as np %matplotlib inline data_url = 'https://DasData.co/e.aspx?das=cv+L1FGsSVaOptLc/yk4zAq367n5yqFqP6X4CbAqoNRv4a27VVX9RZB2jllGPur0GHDpQaG8C9UnU75NR7lWZw==&from=0&to=500&json=1' response = requests.get(data_url, data={"limit" : "500"}) if response.status_code == 200: df = pd.DataFrame.from_records(response.json()) print(df) #==================================================================== df[['id','AIDate','TemperatureBody','OxygenSaturation','HeartRate','AccelX','AccelY','AccelZ','Medication_Note','IndoorTemperatureRAW','IndoorHumidRAW','IndoorPressureRAW','IndoorGasRAW' ]] = df['Table'].apply(pd.Series) #==================================================================== df["AIDate"] = pd.to_datetime(df["AIDate"]) df.set_index('AIDate', inplace=True) df.head() TemperatureBody=df[['TemperatureBody']] OxygenSaturation=df[['OxygenSaturation']] HeartRate=df[['HeartRate']] AccelX=df[['AccelX']] AccelY=df[['AccelY']] AccelZ=df[['AccelZ']] Medication_Note=df[['Medication_Note']] IndoorTemperatureRAW=df[['IndoorTemperatureRAW']] IndoorHumidRAW=df[['IndoorHumidRAW']] IndoorPressureRAW=df[['IndoorPressureRAW']] IndoorGasRAW=df[['IndoorGasRAW']] #==================================================================== df_rm = pd.concat([TemperatureBody.rolling(12).mean(),OxygenSaturation.rolling(12).mean(),HeartRate.rolling(12).mean(),AccelX.rolling(12).mean(),AccelY.rolling(12).mean(),AccelZ.rolling(12).mean(),Medication_Note.rolling(12).mean(),IndoorTemperatureRAW.rolling(12).mean(),IndoorHumidRAW.rolling(12).mean(),IndoorPressureRAW.rolling(12).mean(),IndoorGasRAW.rolling(12).mean()], axis=1) #==================================================================== df_rm.plot(figsize=(20,10), linewidth=2, fontsize=15) x = np.linspace(0, 10, 50) plt.xlabel('AIDate', fontsize=12);