label_numeric = float(metadata.loc[metadata["file_name"] == file.name]["label"])
// test labels are missing and parsed as NaN
if not math.isnan(label_numeric):
label_numeric = int(label_numeric)
else:
label_numeric = None
After Change
label = metadata.loc[metadata["file_name"] == file.name]["label"]
// test labels are missing and parsed as NaN
if all(l != "?" for l in label):
label_numeric = int(label)
else:
label_numeric = None