Where the numbers came from
Not met yet
Where a number came from is part of the number: who measured it, where, with what instrument, under what licence, and what the source's own notes say about it. Station files mark estimated values, provisional months and changes of instrument; keep those marks as columns of their own rather than stripping them and forgetting. Read the notes above a table before the table, find its start rather than counting lines, and credit the source as its licence asks.
Try it
main.pylines = [" 2009 4 12.5* 5.9* 71.0 151.2#",
" 2026 9 15.3 10.1 140.6 94.0# Provisional"]
for line in lines:
fields = line.split()
print(fields[0], "estimated" if "*" in line else "measured",
"provisional" if fields[-1] == "Provisional" else "checked")
Output
Press Run and what your program prints shows up here.
Easy to get wrong
- Thinks pd.to_numeric(errors="coerce") only turns the missing-value marker into NaN. It turns anything that isn't a plain number into NaN, marked values included.
- Thinks the marks after values in a source file (estimated, provisional, a change of instrument) can be stripped and forgotten. They say how far to trust each number.
- Thinks a yearly total with a missing month is still that year's total. It is a smaller number that was never measured.
- Thinks every file from the same source has the same number of lines before the table, so counting them is safe.