예제 #1
0
    def test_bin(self):
        y = np.array([[7, 13, 14], [10, 11, 13], [7, 17, 2], [18, 3, 14],
                      [9, 15, 8], [7, 13, 12], [16, 6, 11], [19, 2, 15],
                      [11, 11, 9], [3, 2, 19]])
        bins = [10, 15, 20]
        expected = np.array([[0, 1, 1], [0, 1, 1], [0, 2, 0], [2, 0, 1],
                             [0, 1, 0], [0, 1, 1], [2, 0, 1], [2, 0, 1],
                             [1, 1, 0], [0, 0, 2]])

        np.testing.assert_array_equal(expected, bin(y, bins))
예제 #2
0
    def test_bin(self):
        y = np.array([[7, 13, 14], [10, 11, 13], [7, 17, 2], [18, 3, 14],
                      [9, 15, 8], [7, 13, 12], [16, 6, 11], [19, 2, 15],
                      [11, 11, 9], [3, 2, 19]])
        bins = [10, 15, 20]
        expected = np.array([[0, 1, 1], [0, 1, 1], [0, 2, 0], [2, 0, 1],
                             [0, 1, 0], [0, 1, 1], [2, 0, 1], [2, 0, 1],
                             [1, 1, 0], [0, 0, 2]])

        np.testing.assert_array_equal(expected, bin(y, bins))