Update compliance_heatmap to handle empty dataframes from all sensors

replace/7accd44d8cdc56f8ed0d3dcd240ab0adf1562f40
JulioV 2019-11-13 14:55:22 -05:00
parent d24c62392a
commit f7be15ea9e
1 changed files with 16 additions and 12 deletions

View File

@ -55,7 +55,11 @@ for sensor_path in snakemake.input:
else:
sensors_five_minutes_row_is = pd.concat([sensors_five_minutes_row_is, sensor_five_minutes_row_is]).groupby("local_date_time").sum()
if sensors_five_minutes_row_is.empty:
empty_html = open(snakemake.output[0], "w")
empty_html.write("There is no sensor data for " + pid)
empty_html.close()
else:
sensors_five_minutes_row_is.reset_index(inplace=True)
# resample again to impute missing dates
sensors_five_minutes_row_is_successive = pd.DataFrame(sensors_five_minutes_row_is.resample("5T", on="local_date_time")["has_row"].sum())