added error catching for no cands

This commit is contained in:
Sakimori 2025-09-01 13:53:16 -04:00
parent 7490569987
commit 918e026f55
No known key found for this signature in database

View file

@ -13,9 +13,12 @@ def process(directory):
dirname = os.path.basename(subdir)
if dirname == '':
dirname = os.path.basename(os.path.dirname(subdir))
mainCSV = pd.read_csv(os.path.join(subdir, f"{dirname}.csv"))
candCSV = pd.read_csv(os.path.join(subdir, "cands","results_a.csv"))
merge(mainCSV, candCSV, os.path.join(subdir, f"{dirname}_merged.csv"))
try:
mainCSV = pd.read_csv(os.path.join(subdir, f"{dirname}.csv"))
candCSV = pd.read_csv(os.path.join(subdir, "cands","results_a.csv"))
merge(mainCSV, candCSV, os.path.join(subdir, f"{dirname}_merged.csv"))
except FileNotFoundError:
logger.error(f"{dirname} has no candidates!")
def merge(mainDF:pd.DataFrame, candDF:pd.DataFrame, outname):
#add new columns to main dataframe