Skip to content
DeepForgeby svx
All problems
EasyData Structuresds-263

Column Statistics Min/Max

Problem

Compute basic column statistics for a nullable column.

values may contain None entries. Return [minimum, maximum, null_count]; when every value is None or the column is empty, the minimum and maximum are None.

Return the statistics list.

Hint

Min and max consider only the non-null values.

Test cases

case 1
in: [[3,null,1,7]]
expected: [1,7,1]
case 2
in: [[]]
expected: [null,null,0]
case 3
in: [[null,null]]
expected: [null,null,2]
case 4
in: [[-5,0,-1]]
expected: [-5,0,0]
Starter codePython
def column_stats(values):
    # Your code here
    pass

4 test cases · run your code against them in the editor