Fill the Holes
Some cells of the table df are missing. Return its values with every missing cell replaced by the mean of the cells that are present in its column.
Example 1
df {"a":[1,null,3],"b":[10,20,null]}
returns [[1.0,10.0],[2.0,20.0],[3.0,15.0]]
Column a is missing its middle value: the mean of 1 and 3 is 2. Column b gets the mean of 10 and 20.
Constraints
- 2 to 20 rows, 1 to 3 number columns
- Every column has at least one value present
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.