Volunteers read river-level gauges and upload their readings as a CSV file with two columns, station and level_cm. The uploads are messy:
" north" and "NORTH" are the same stationerr or dryTask: write gauge_report(path). The starter code includes write_text(path, text), which saves CSV text to a file and returns its path. Each test passes that path straight to gauge_report. Load the file at path with pandas, then clean it in this order:
station, then put it in title case.level_cm to numbers. Anything that can't be read becomes missing.quantile(0.25) and quantile(0.75). A level is an outlier if it's strictly outside a fence.Return a dictionary:
"rows": how many rows are left after step 4, as a whole number"stations": the different stations left after step 4, in the order they first appear"outliers": a list of [station, level] pairs for every outlier, in row order, with each level as a number. [] if there are none.At least one level in every file can be read, and every file has at least one level that is not a whole number, so the column always reads as text or decimals.