示例#1
0
 def test_2d(self):
     x = [[1, 2, 3],
         [4, 5, 6],
         [7, 8, 9]]
     assert_allclose(mean(x), [2, 5, 8])
     assert_allclose(mean(x, axis=-1), [2, 5, 8])
     assert_allclose(mean(x, axis=1), [2, 5, 8])
     assert_allclose(mean(x, axis=0), [4, 5, 6])
示例#2
0
 def test_1d(self):
     x = [1, 2, 3, 4, 5, 6]
     assert mean(x) == 3.5