Create the smallest input that still produces the error.
values = ["10", "20", "missing"]for value in values:try: number =float(value)print(number)exceptValueErroras error:print(f"Could not convert {value!r}: {error}")
10.0
20.0
Could not convert 'missing': could not convert string to float: 'missing'
25.2 Checklist
Read the last line of the traceback.
Confirm the variable and column names.
Inspect data types.
Print a small sample.
Check missing values.
Confirm file paths and the working directory.
Test one operation at a time.
Verify assumptions with assertions.
records = [{"id": 1}, {"id": 2}]assertall("id"in record for record in records)