From 004a63da0aa64fe90e4dac70ee3316b8746bbcf1 Mon Sep 17 00:00:00 2001 From: edgaregurrola Date: Fri, 23 Jul 2021 12:51:49 -0500 Subject: [PATCH] Fixes empty gdf in 12 update script --- scripts/12-update-plumelab-data.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/scripts/12-update-plumelab-data.py b/scripts/12-update-plumelab-data.py index 37312f3..0d9262c 100644 --- a/scripts/12-update-plumelab-data.py +++ b/scripts/12-update-plumelab-data.py @@ -226,16 +226,17 @@ def main(): gdf_aq['sensor_id'] = s gdf_all = gdf_all.append(gdf_aq) + + if len(gdf_all) > 0: + gdf_all.drop_duplicates(inplace=True) - gdf_all.drop_duplicates(inplace=True) - - gdf_all['date'] = gdf_all['date'].astype('int') + gdf_all['date'] = gdf_all['date'].astype('int') - aqiGDL.log('Done with download') - aqiGDL.gdf_to_db(gdf_all, 'plumbe', - schema='public', if_exists='append') - - aqiGDL.log('Data in DB') + aqiGDL.log('Done with download') + aqiGDL.gdf_to_db(gdf_all, 'plumbe', + schema='public', if_exists='append') + + aqiGDL.log('Data in DB') if __name__ == "__main__":