A sensor logs one reading per hour, but sometimes it drops out. A missing reading is stored as None.
Task: write fill_gaps(values, strategy).
values is a list of numbers with some None entries. At least one value is not None.strategy is "mean", "median" or "most_frequent".SimpleImputer(strategy=strategy) fitted on these values."most_frequent" with a tie, the imputer picks the smallest of the tied values. You don't need to do anything special.Tip: pd.DataFrame({"reading": values}, dtype=float) turns each None into np.nan, which is how the imputer spots a gap.