def __setitem__(self, key, value):
        if type(key) == slice:
            raise ValueError('assignment by slice not supported')
        if len(key) != 2:
            raise KeyError('invalid key')
        row, col = key
        if not self._data:
            label = list(set(key))
            self._data = la.larry(np.zeros(2*(len(label),), type(value)),
                                  [label, label])
        else:

            # If either the row or column identifier isn't in the
            # current list of labels, add it:
            for k in key:

                # Create new row:
                if k not in self._data.label[0]:
                    self._data = self._data.merge(la.larry([[0]*len(self._data.label[1])],
                                                           [[k], self._data.label[1]]))

                # Create new column:
                if k not in self._data.label[1]:
                    self._data = self._data.merge(la.larry([[0]]*len(self._data.label[0]),
                                                           [self._data.label[0], [k]]))
        self._data.set([row, col], int(value))
Exemple #2
0
 def test_panel_1(self):
     "func.panel_1"         
     original = larry(np.arange(24).reshape(2,3,4))                   
     actual = panel(original)
     x = np.array([[ 0, 12],
                   [ 4, 16],
                   [ 8, 20],
                   [ 1, 13],
                   [ 5, 17],
                   [ 9, 21],
                   [ 2, 14],
                   [ 6, 18],
                   [10, 22],
                   [ 3, 15],
                   [ 7, 19],
                   [11, 23]])
     label = [[(0, 0),
               (0, 1),
               (0, 2),
               (0, 3),
               (1, 0),
               (1, 1),
               (1, 2),
               (1, 3),
               (2, 0),
               (2, 1),
               (2, 2),
               (2, 3)], [0, 1]]
     desired = larry(x, label)         
     ale(actual, desired, msg='panel test #1', original=original) 
Exemple #3
0
 def test_panel_2(self):
     "func.panel_2" 
     x = np.ones((4,3)).cumsum(0) - 1
     label = [['r1', 'r2', 'r3', 'r4'], ['c1', 'c2', 'c3']]
     original = larry(x, label)
     original = original.insertaxis(0, "name")
     y = original.copy()
     y.label[0] = ["two"]
     original = original.merge(y)
     actual = panel(original)
     x = np.array([[0,0,0,1,1,1,2,2,2,3,3,3]], dtype=np.float).T
     x = np.hstack((x,x))
     label = [[('r1', 'c1'),
               ('r1', 'c2'),
               ('r1', 'c3'),
               ('r2', 'c1'),
               ('r2', 'c2'),
               ('r2', 'c3'),
               ('r3', 'c1'),
               ('r3', 'c2'),
               ('r3', 'c3'),
               ('r4', 'c1'),
               ('r4', 'c2'),
               ('r4', 'c3')], ['name', 'two']]
     desired = larry(x, label)         
     ale(actual, desired, msg='panel test #2', original=original) 
Exemple #4
0
 def test_squeeze(self):
     "larry.squeeze" 
     t = self.lar.x
     label = self.lar.label
     x = self.lar.x[None,:]
     lar = larry(x)
     p = larry(x).squeeze()
     self.check_function(t, label, p, lar, view='skip') #should be nocopy
Exemple #5
0
 def test_io_len(self):
     "io_len"
     io = IO(self.filename)
     x = larry([1,2,3])
     y = larry([7,8,9])
     io['x'] = x
     io['y'] = y
     self.assertTrue(len(io) == 2, 'number of keys is wrong')
def make_larrys():
    a1 = np.array([[ 1.0, nan],
                   [ 3.0, 4.0],
                   [ 5.0, 6.0]])                                              
    lar1 = larry(a1) 
    a2 = np.array([ 0, 1, 2, 3])                                              
    lar2 = larry(a2)
    return lar1, lar2
Exemple #7
0
 def test_add_19(self):
     "add test #19"
     y1 = larry([1, nan, nan, 1])
     y2 = larry([1, 1,   nan, 1], [[0, 1, 2, 9]])
     actual = add(y1, y2, join='outer', missone=0)
     desired = larry([2, 1, nan, 1, 1], [[0, 1, 2, 3, 9]])
     msg = "add failed"
     ale(actual, desired, msg, original=y1)
     ale(actual, desired, msg, original=y2)
Exemple #8
0
 def test_add_16(self):
     "add test #16"
     y1 = larry([1, 2])
     y2 = larry([1, 2, 3])
     actual = add(y1, y2, join='right', misstwo=0)
     desired = larry([2, 4, nan])
     msg = "add failed"
     ale(actual, desired, msg, original=y1)
     ale(actual, desired, msg, original=y2)
Exemple #9
0
 def test_2d22(self):
     "la.align() crash with empty larrys (gh #67)"
     a = larry([[]])
     b = larry([[1, 2, 3], [4, 5, 6]])
     for j in ('inner', 'outer', 'left', 'right', 'skip'):
         align(a, a, join=j)
         align(b, b, join=j)
         align(a, b, join=j)
         align(b, a, join=j)
Exemple #10
0
 def test_binaryop_21(self):
     "binaryop test #21"
     y1 = larry([True, True])
     y2 = larry([True, False, True])
     actual = binaryop(np.logical_and, y1, y2)
     desired = larry([True, False])
     msg = "binaryop failed"
     ale(actual, desired, msg, original=y1)
     ale(actual, desired, msg, original=y2) 
Exemple #11
0
 def test_binaryop_16(self):
     "binaryop test #16"
     y1 = larry([1, 2])
     y2 = larry([1, 2, 3])
     actual = binaryop(np.add, y1, y2, join='right', misstwo=0)
     desired = larry([2, 4, nan])
     msg = "binaryop failed"
     ale(actual, desired, msg, original=y1)
     ale(actual, desired, msg, original=y2)
Exemple #12
0
 def test_binaryop_05(self):
     "binaryop test #05"
     y1 = larry([1, 2])
     y2 = larry([1, 2, 3])
     actual = binaryop(np.add, y1, y2, misstwo=0)
     desired = larry([2, 4])
     msg = "binaryop failed"
     ale(actual, desired, msg, original=y1)
     ale(actual, desired, msg, original=y2)
Exemple #13
0
 def test_divide_01(self):
     "divide test #01"
     y1 = larry([1,   2, nan], [['a', 'b', 'c']])
     y2 = larry([1, nan, nan], [['a', 'b', 'dd']])
     actual = divide(y1, y2, join='outer', missone=1, misstwo=2)
     desired = larry([1, 2, 1, 1], [['a', 'b', 'c', 'dd']], dtype=float)
     msg = "divide failed"
     ale(actual, desired, msg, original=y1)
     ale(actual, desired, msg, original=y2)
Exemple #14
0
 def test_binaryop_06(self):
     "binaryop test #06"
     y1 = larry([1, 2])
     y2 = larry([1, 2, 3])
     actual = binaryop(np.add, y1, y2, join='outer')
     desired = larry([2, 4, nan])
     msg = "binaryop failed"
     ale(actual, desired, msg, original=y1)
     ale(actual, desired, msg, original=y2)
Exemple #15
0
 def test_binaryop_05(self):
     "binaryop test #05"
     y1 = larry([1, 2])
     y2 = larry([1, 2, 3])
     actual = binaryop(np.add, y1, y2, misstwo=0)
     desired = larry([2, 4])
     msg = "binaryop failed"
     ale(actual, desired, msg, original=y1)
     ale(actual, desired, msg, original=y2)
Exemple #16
0
 def test_io_7(self):
     "io_empty (gh #68)"
     io = IO(self.filename)
     desired = larry([])
     io['desired'] = desired
     actual = io['desired']
     if actual.size == 0:
         actual = la.larry([])
     assert_larry_equal(actual, desired)
Exemple #17
0
 def test_1d21(self):
     "align 1d test #21"
     y1 = larry([1, 2, 3])
     y2 = larry([1, 2, 3, 4])
     a1, a2 = align(y1, y2, join='skip')
     d1, d2 = y1.copy(), y2.copy()
     msg = "align 1d fail on %s larry"
     ale(a1, d1, msg % 'left', original=y1)
     ale(a2, d2, msg % 'right', original=y2)
Exemple #18
0
 def test_binaryop_19(self):
     "binaryop test #19"
     y1 = larry([1, nan, nan, 1])
     y2 = larry([1, 1, nan, 1], [[0, 1, 2, 9]])
     actual = binaryop(np.add, y1, y2, join='outer', missone=0)
     desired = larry([2, 1, nan, 1, 1], [[0, 1, 2, 3, 9]])
     msg = "binaryop failed"
     ale(actual, desired, msg, original=y1)
     ale(actual, desired, msg, original=y2)
Exemple #19
0
 def test_subtract_02(self):
     "subtract test #02"
     y1 = larry([1,   2, nan], [['a', 'b', 'c']])
     y2 = larry([1, nan, nan], [['a', 'b', 'dd']])
     actual = subtract(y1, y2, missone=0)
     desired = larry([0, 2], [['a', 'b']], dtype=float)
     msg = "subtract failed"
     ale(actual, desired, msg, original=y1)
     ale(actual, desired, msg, original=y2) 
Exemple #20
0
 def test_binaryop_12(self):
     "binaryop test #12"
     y1 = larry([1, 2])
     y2 = larry([1, 2, 3])
     actual = binaryop(np.add, y1, y2, join='left', missone=0, misstwo=0)
     desired = larry([2, 4])
     msg = "binaryop failed"
     ale(actual, desired, msg, original=y1)
     ale(actual, desired, msg, original=y2)
Exemple #21
0
 def test_subtract_04(self):
     "subtract test #04"
     y1 = larry([1,   2, nan], [['a', 'b', 'c']])
     y2 = larry([1, nan, nan], [['a', 'b', 'dd']])
     actual = subtract(y1, y2, join='outer', missone=0, misstwo=0)
     desired = larry([0, 2, 0, 0], [['a', 'b', 'c', 'dd']], dtype=float)
     msg = "subtract failed"
     ale(actual, desired, msg, original=y1)
     ale(actual, desired, msg, original=y2)              
Exemple #22
0
 def test_stack_1(self):
     "func.stack_1"
     y1 = larry([[1, 2], [3, 4]])
     y2 = larry([[5, 6], [7, 8]])
     actual = stack('union', name1=y1, othername=y2)
     x = np.array([[[5., 6.], [7., 8.]], [[1., 2.], [3., 4.]]])
     label = [['othername', 'name1'], [0, 1], [0, 1]]
     desired = larry(x, label)
     ale(actual, desired, msg='stack test #1')
Exemple #23
0
 def test_1d21(self):
     "align 1d test #21"
     y1 = larry([1, 2, 3])
     y2 = larry([1, 2, 3, 4])
     a1, a2 = align(y1, y2, join='skip')
     d1, d2 = y1.copy(), y2.copy()
     msg = "align 1d fail on %s larry"
     ale(a1, d1, msg % 'left', original=y1)
     ale(a2, d2, msg % 'right', original=y2)
Exemple #24
0
 def test_multiply_01(self):
     "multiply test #01"
     y1 = larry([1, 2, nan], [['a', 'b', 'c']])
     y2 = larry([1, nan, nan], [['a', 'b', 'dd']])
     actual = multiply(y1, y2, join='outer', missone=1, misstwo=2)
     desired = larry([1, 2, 4, 4], [['a', 'b', 'c', 'dd']], dtype=float)
     msg = "multiply failed"
     ale(actual, desired, msg, original=y1)
     ale(actual, desired, msg, original=y2)
Exemple #25
0
 def test_binaryop_12(self):
     "binaryop test #12"
     y1 = larry([1, 2])
     y2 = larry([1, 2, 3])
     actual = binaryop(np.add, y1, y2, join='left', missone=0, misstwo=0)
     desired = larry([2, 4])
     msg = "binaryop failed"
     ale(actual, desired, msg, original=y1)
     ale(actual, desired, msg, original=y2)       
Exemple #26
0
 def test_subtract_03(self):
     "subtract test #03"
     y1 = larry([1, 2, nan], [['a', 'b', 'c']])
     y2 = larry([1, nan, nan], [['a', 'b', 'dd']])
     actual = subtract(y1, y2, join='outer')
     desired = larry([0, nan, nan, nan], [['a', 'b', 'c', 'dd']])
     msg = "subtract failed"
     ale(actual, desired, msg, original=y1)
     ale(actual, desired, msg, original=y2)
Exemple #27
0
 def test_binaryop_18(self):
     "binaryop test #18"
     y1 = larry([1, nan, nan, 1])
     y2 = larry([1, 1,   nan, 1], [[0, 1, 2, 9]])
     actual = binaryop(np.add, y1, y2, join='outer')
     desired = larry([2, nan, nan, nan, nan], [[0, 1, 2, 3, 9]])
     msg = "binaryop failed"
     ale(actual, desired, msg, original=y1)
     ale(actual, desired, msg, original=y2)
Exemple #28
0
 def test_divide_01(self):
     "divide test #01"
     y1 = larry([1, 2, nan], [['a', 'b', 'c']])
     y2 = larry([1, nan, nan], [['a', 'b', 'dd']])
     actual = divide(y1, y2, join='outer', missone=1, misstwo=2)
     desired = larry([1, 2, 1, 1], [['a', 'b', 'c', 'dd']], dtype=float)
     msg = "divide failed"
     ale(actual, desired, msg, original=y1)
     ale(actual, desired, msg, original=y2)
Exemple #29
0
 def test_binaryop_15(self):
     "binaryop test #15"
     y1 = larry([1, 2])
     y2 = larry([1, 2, 3])
     actual = binaryop(np.add, y1, y2, join='right', missone=0, misstwo=0)
     desired = larry([2, 4, 3], dtype=float)
     msg = "binaryop failed"
     ale(actual, desired, msg, original=y1)
     ale(actual, desired, msg, original=y2)
Exemple #30
0
 def test_2d9(self):
     "align 2d test #9"
     y1 = larry([[1, 2], [3, 4]])
     y2 = larry([[1, 2, 5], [3, 4, 6]])
     a1, a2 = align(y1, y2, 'skip')
     d1, d2 = y1.copy(), y2.copy()
     msg = "align 2d fail on %s larry"
     ale(a1, d1, msg % 'left', original=y1)
     ale(a2, d2, msg % 'right', original=y2)
Exemple #31
0
 def test_subtract_02(self):
     "subtract test #02"
     y1 = larry([1, 2, nan], [['a', 'b', 'c']])
     y2 = larry([1, nan, nan], [['a', 'b', 'dd']])
     actual = subtract(y1, y2, missone=0)
     desired = larry([0, 2], [['a', 'b']], dtype=float)
     msg = "subtract failed"
     ale(actual, desired, msg, original=y1)
     ale(actual, desired, msg, original=y2)
Exemple #32
0
 def test_binaryop_16(self):
     "binaryop test #16"
     y1 = larry([1, 2])
     y2 = larry([1, 2, 3])
     actual = binaryop(np.add, y1, y2, join='right', misstwo=0)
     desired = larry([2, 4, nan])
     msg = "binaryop failed"
     ale(actual, desired, msg, original=y1)
     ale(actual, desired, msg, original=y2)
Exemple #33
0
 def test_binaryop_18(self):
     "binaryop test #18"
     y1 = larry([1, nan, nan, 1])
     y2 = larry([1, 1, nan, 1], [[0, 1, 2, 'a']])
     actual = binaryop(np.add, y1, y2, join='outer')
     desired = larry([2, nan, nan, nan, nan], [[0, 1, 2, 3, 'a']])
     msg = "binaryop failed"
     ale(actual, desired, msg, original=y1)
     ale(actual, desired, msg, original=y2)
Exemple #34
0
 def test_binaryop_20(self):
     "binaryop test #20"
     y1 = larry([1, nan, nan, 1])
     y2 = larry([1, 1, nan, 1], [[0, 1, 2, 'a']])
     actual = binaryop(np.add, y1, y2, join='outer', missone=0, misstwo=0)
     desired = larry([2, 1, 0, 1, 1], [[0, 1, 2, 3, 'a']], dtype=float)
     msg = "binaryop failed"
     ale(actual, desired, msg, original=y1)
     ale(actual, desired, msg, original=y2)
Exemple #35
0
 def test_add_15(self):
     "add test #15"
     y1 = larry([1, 2])
     y2 = larry([1, 2, 3])
     actual = add(y1, y2, join='right', missone=0, misstwo=0)
     desired = larry([2, 4, 3], dtype=float)
     msg = "add failed"
     ale(actual, desired, msg, original=y1)
     ale(actual, desired, msg, original=y2)
Exemple #36
0
 def test_binaryop_21(self):
     "binaryop test #21"
     y1 = larry([True, True])
     y2 = larry([True, False, True])
     actual = binaryop(np.logical_and, y1, y2)
     desired = larry([True, False])
     msg = "binaryop failed"
     ale(actual, desired, msg, original=y1)
     ale(actual, desired, msg, original=y2)
Exemple #37
0
 def test_add_17(self):
     "add test #17"
     y1 = larry([1, nan, nan, 1])
     y2 = larry([1, 1,   nan, 1], [[0, 1, 2, 'a']])
     actual = add(y1, y2)
     desired = larry([2, nan, nan], [[0, 1, 2]])
     msg = "add failed"
     ale(actual, desired, msg, original=y1)
     ale(actual, desired, msg, original=y2)
Exemple #38
0
 def test_add_03(self):
     "add test #03"
     y1 = larry([1, 2])
     y2 = larry([1, 2, 3])
     actual = add(y1, y2, join='inner', missone=0)
     desired = larry([2, 4])
     msg = "add failed"
     ale(actual, desired, msg, original=y1)
     ale(actual, desired, msg, original=y2)
Exemple #39
0
 def test_add_20(self):
     "add test #20"
     y1 = larry([1, nan, nan, 1])
     y2 = larry([1, 1,   nan, 1], [[0, 1, 2, 9]])
     actual = add(y1, y2, join='outer', missone=0, misstwo=0)
     desired = larry([2, 1, 0, 1, 1], [[0, 1, 2, 3, 9]], dtype=float)
     msg = "add failed"
     ale(actual, desired, msg, original=y1)
     ale(actual, desired, msg, original=y2)
Exemple #40
0
 def test_add_05(self):
     "add test #05"
     y1 = larry([1, 2])
     y2 = larry([1, 2, 3])
     actual = add(y1, y2, misstwo=0)
     desired = larry([2, 4])
     msg = "add failed"
     ale(actual, desired, msg, original=y1)
     ale(actual, desired, msg, original=y2)
Exemple #41
0
 def test_subtract_03(self):
     "subtract test #03"
     y1 = larry([1,   2, nan], [['a', 'b', 'c']])
     y2 = larry([1, nan, nan], [['a', 'b', 'dd']])
     actual = subtract(y1, y2, join='outer')
     desired = larry([0, nan, nan, nan], [['a', 'b', 'c', 'dd']])
     msg = "subtract failed"
     ale(actual, desired, msg, original=y1)
     ale(actual, desired, msg, original=y2)         
Exemple #42
0
 def test_add_06(self):
     "add test #06"
     y1 = larry([1, 2])
     y2 = larry([1, 2, 3])
     actual = add(y1, y2, join='outer')
     desired = larry([2, 4, nan])
     msg = "add failed"
     ale(actual, desired, msg, original=y1)
     ale(actual, desired, msg, original=y2)
Exemple #43
0
 def test_multiply_01(self):
     "multiply test #01"
     y1 = larry([1,   2, nan], [['a', 'b', 'c']])
     y2 = larry([1, nan, nan], [['a', 'b', 'dd']])
     actual = multiply(y1, y2, join='outer', missone=1, misstwo=2)
     desired = larry([1, 2, 4, 4], [['a', 'b', 'c', 'dd']], dtype=float)
     msg = "multiply failed"
     ale(actual, desired, msg, original=y1)
     ale(actual, desired, msg, original=y2)
Exemple #44
0
 def test_add_07(self):
     "add test #07"
     y1 = larry([1, 2])
     y2 = larry([1, 2, 3])
     actual = add(y1, y2, join='outer', missone=0)
     desired = larry([2, 4, 3], dtype=float)
     msg = "add failed"
     ale(actual, desired, msg, original=y1)
     ale(actual, desired, msg, original=y2)
Exemple #45
0
 def test_cov_2(self):
     "func.cov_2" 
     original = larry([[nan, 2.0, 1.0],
                       [2.0, 3.0, 1.0],
                       [4.0, 1.0, 1.0]])  
     original = original.demean(1)        
     desired = larry(np.ma.cov(np.ma.fix_invalid(original.x), bias=1).data)
     actual = cov(original)
     ale(actual, desired, msg='cov test #2', original=original) 
Exemple #46
0
 def test_add_10(self):
     "add test #10"
     y1 = larry([1, 2])
     y2 = larry([1, 2, 3])
     actual = add(y1, y2, join='left')
     desired = larry([2, 4])
     msg = "add failed"
     ale(actual, desired, msg, original=y1)
     ale(actual, desired, msg, original=y2)
Exemple #47
0
 def test_2d9(self):
     "align 2d test #9"
     y1 = larry([[1, 2],    [3, 4]])
     y2 = larry([[1, 2, 5], [3, 4, 6]])
     a1, a2 = align(y1, y2, 'skip')
     d1, d2 = y1.copy(), y2.copy()
     msg = "align 2d fail on %s larry"
     ale(a1, d1, msg % 'left', original=y1)
     ale(a2, d2, msg % 'right', original=y2)            
Exemple #48
0
 def test_add_12(self):
     "add test #12"
     y1 = larry([1, 2])
     y2 = larry([1, 2, 3])
     actual = add(y1, y2, join='left', missone=0, misstwo=0)
     desired = larry([2, 4])
     msg = "add failed"
     ale(actual, desired, msg, original=y1)
     ale(actual, desired, msg, original=y2)
Exemple #49
0
 def test_binaryop_06(self):
     "binaryop test #06"
     y1 = larry([1, 2])
     y2 = larry([1, 2, 3])
     actual = binaryop(np.add, y1, y2, join='outer')
     desired = larry([2, 4, nan])
     msg = "binaryop failed"
     ale(actual, desired, msg, original=y1)
     ale(actual, desired, msg, original=y2)
Exemple #50
0
 def test_add_15(self):
     "add test #15"
     y1 = larry([1, 2])
     y2 = larry([1, 2, 3])
     actual = add(y1, y2, join='right', missone=0, misstwo=0)
     desired = larry([2, 4, 3], dtype=float)
     msg = "add failed"
     ale(actual, desired, msg, original=y1)
     ale(actual, desired, msg, original=y2)
Exemple #51
0
 def test_binaryop_15(self):
     "binaryop test #15"
     y1 = larry([1, 2])
     y2 = larry([1, 2, 3])
     actual = binaryop(np.add, y1, y2, join='right', missone=0, misstwo=0)
     desired = larry([2, 4, 3], dtype=float)
     msg = "binaryop failed"
     ale(actual, desired, msg, original=y1)
     ale(actual, desired, msg, original=y2)
Exemple #52
0
 def test_add_16(self):
     "add test #16"
     y1 = larry([1, 2])
     y2 = larry([1, 2, 3])
     actual = add(y1, y2, join='right', misstwo=0)
     desired = larry([2, 4, nan])
     msg = "add failed"
     ale(actual, desired, msg, original=y1)
     ale(actual, desired, msg, original=y2)
Exemple #53
0
 def test_binaryop_17(self):
     "binaryop test #17"
     y1 = larry([1, nan, nan, 1])
     y2 = larry([1, 1,   nan, 1], [[0, 1, 2, 'a']])
     actual = binaryop(np.add, y1, y2)
     desired = larry([2, nan, nan], [[0, 1, 2]])
     msg = "binaryop failed"
     ale(actual, desired, msg, original=y1)
     ale(actual, desired, msg, original=y2)
Exemple #54
0
 def test_add_17(self):
     "add test #17"
     y1 = larry([1, nan, nan, 1])
     y2 = larry([1, 1, nan, 1], [[0, 1, 2, 'a']])
     actual = add(y1, y2)
     desired = larry([2, nan, nan], [[0, 1, 2]])
     msg = "add failed"
     ale(actual, desired, msg, original=y1)
     ale(actual, desired, msg, original=y2)
Exemple #55
0
 def test_binaryop_20(self):
     "binaryop test #20"
     y1 = larry([1, nan, nan, 1])
     y2 = larry([1, 1,   nan, 1], [[0, 1, 2, 9]])
     actual = binaryop(np.add, y1, y2, join='outer', missone=0, misstwo=0)
     desired = larry([2, 1, 0, 1, 1], [[0, 1, 2, 3, 9]], dtype=float)
     msg = "binaryop failed"
     ale(actual, desired, msg, original=y1)
     ale(actual, desired, msg, original=y2)
Exemple #56
0
 def test_add_19(self):
     "add test #19"
     y1 = larry([1, nan, nan, 1])
     y2 = larry([1, 1, nan, 1], [[0, 1, 2, 'a']])
     actual = add(y1, y2, join='outer', missone=0)
     desired = larry([2, 1, nan, 1, 1], [[0, 1, 2, 3, 'a']])
     msg = "add failed"
     ale(actual, desired, msg, original=y1)
     ale(actual, desired, msg, original=y2)
Exemple #57
0
 def test_add_02(self):
     "add test #02"
     y1 = larry([1, 2])
     y2 = larry([1, 2, 3])
     actual = add(y1, y2, join='inner')
     desired = larry([2, 4])
     msg = "add failed"
     ale(actual, desired, msg, original=y1)
     ale(actual, desired, msg, original=y2)
Exemple #58
0
 def test_add_20(self):
     "add test #20"
     y1 = larry([1, nan, nan, 1])
     y2 = larry([1, 1, nan, 1], [[0, 1, 2, 'a']])
     actual = add(y1, y2, join='outer', missone=0, misstwo=0)
     desired = larry([2, 1, 0, 1, 1], [[0, 1, 2, 3, 'a']], dtype=float)
     msg = "add failed"
     ale(actual, desired, msg, original=y1)
     ale(actual, desired, msg, original=y2)
Exemple #59
0
 def test_add_04(self):
     "add test #04"
     y1 = larry([1, 2])
     y2 = larry([1, 2, 3])
     actual = add(y1, y2, join='inner', missone=0, misstwo=0)
     desired = larry([2, 4])
     msg = "add failed"
     ale(actual, desired, msg, original=y1)
     ale(actual, desired, msg, original=y2)
Exemple #60
0
 def test_subtract_04(self):
     "subtract test #04"
     y1 = larry([1, 2, nan], [['a', 'b', 'c']])
     y2 = larry([1, nan, nan], [['a', 'b', 'dd']])
     actual = subtract(y1, y2, join='outer', missone=0, misstwo=0)
     desired = larry([0, 2, 0, 0], [['a', 'b', 'c', 'dd']], dtype=float)
     msg = "subtract failed"
     ale(actual, desired, msg, original=y1)
     ale(actual, desired, msg, original=y2)