if "grade" in data:
data["grade"] = float(data["grade"])
if "grade_abs" in data:
data["grade_abs"] = float(data["grade_abs"])
// these attributes might have a single value, or a list if edge"s
// topology was simplified
After Change
if attr in data:
if data[attr].startswith("[") and data[attr].endswith("]"):
// if it"s a list, eval it then convert each item to float
data[attr] = [float(a) for a in ast.literal_eval(data[attr])]
else:
data[attr] = float(data[attr])