Skip to content
DeepForgeby svx
All problems
EasyLinear Algebrala-144

Column Means

Problem

Compute the mean of each column of data, given as a list of samples (rows) with one feature per column.

Return the means in column order as floats.

Hint

Average down each column, not across each row.

Test cases

case 1
in: [[[1,2],[3,4],[5,6]]]
expected: [3,4]
case 2
in: [[[1,2],[2,4]]]
expected: [1.5,3]
case 3
in: [[[5,5],[5,5]]]
expected: [5,5]
case 4
in: [[[1,3,5]]]
expected: [1,3,5]
Starter codePython
def column_means(data):
    # Your code here
    pass

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