From 9ad2fdea33104644a526f319b18fb4ad7e208edd Mon Sep 17 00:00:00 2001 From: Dan Howe Date: Fri, 1 Mar 2019 17:13:47 +1100 Subject: [PATCH] Skip empty dataframes when processing multiple basins --- waternsw_grabber/waternsw_grabber.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/waternsw_grabber/waternsw_grabber.py b/waternsw_grabber/waternsw_grabber.py index 4d10ab9..a0448ab 100644 --- a/waternsw_grabber/waternsw_grabber.py +++ b/waternsw_grabber/waternsw_grabber.py @@ -506,6 +506,10 @@ def extract_records(input_dir, output_dir, clean_up=False): for basin_code in basin_codes: for period in periods: + # Ignore empty dataframes + if len(master[basin_code][period]) == 0: + continue + # Get latest date from dataframe latest_date = master[basin_code][period].index[-1].strftime( '%Y-%m-%d')