added error catching for no cands
This commit is contained in:
parent
7490569987
commit
918e026f55
|
@ -13,9 +13,12 @@ def process(directory):
|
||||||
dirname = os.path.basename(subdir)
|
dirname = os.path.basename(subdir)
|
||||||
if dirname == '':
|
if dirname == '':
|
||||||
dirname = os.path.basename(os.path.dirname(subdir))
|
dirname = os.path.basename(os.path.dirname(subdir))
|
||||||
mainCSV = pd.read_csv(os.path.join(subdir, f"{dirname}.csv"))
|
try:
|
||||||
candCSV = pd.read_csv(os.path.join(subdir, "cands","results_a.csv"))
|
mainCSV = pd.read_csv(os.path.join(subdir, f"{dirname}.csv"))
|
||||||
merge(mainCSV, candCSV, os.path.join(subdir, f"{dirname}_merged.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):
|
def merge(mainDF:pd.DataFrame, candDF:pd.DataFrame, outname):
|
||||||
#add new columns to main dataframe
|
#add new columns to main dataframe
|
||||||
|
|
Loading…
Reference in a new issue