Fixed dividing by zero error

master
Jonathan Chan 1 year ago
parent 91f8fa692f
commit 82e3ef48a2

@ -107,7 +107,11 @@ for site in os.listdir(images_dir): # Loop through SITES
# Add site stability data (# registered / # processed) # Add site stability data (# registered / # processed)
for i, row in stats_csv.iterrows(): for i, row in stats_csv.iterrows():
stability = "{0:.0%}".format(stats_csv.at[i, '# registered'] / stats_csv.at[i, '# photoshop'])
if stats_csv.at[i, '# photoshop'] != 0:
stability = "{0:.0%}".format(stats_csv.at[i, '# registered'] / stats_csv.at[i, '# photoshop'])
else:
stability = 'NaN' # or whatever value makes sense in your context
stats_csv.at[i,'stability'] = stability stats_csv.at[i,'stability'] = stability
stats_csv.set_index('site', inplace = True) stats_csv.set_index('site', inplace = True)

Loading…
Cancel
Save