コード例 #1
0
 def test_fewer_then_n_nonzero_in_col(self):
     M = cast_list_of_list_to_sa([[0, 2, 3], [0, 3, 4], [1, 4, 5]],
                                 col_names=['height', 'weight', 'age'])
     arguments = [{'func': fewer_then_n_nonzero_in_col, 'vals': 2}]
     M = remove_col_where(M, arguments)
     correct = cast_list_of_list_to_sa([[2, 3], [3, 4], [4, 5]],
                                       col_names=['weight', 'age'])
     self.assertTrue(np.array_equal(M, correct))
コード例 #2
0
 def test_all_same_value(self):
     M = cast_list_of_list_to_sa([[1, 2, 3], [1, 3, 4], [1, 4, 5]],
                                 col_names=['height', 'weight', 'age'])
     arguments = [{'func': all_same_value, 'vals': None}]
     M = remove_col_where(M, arguments)
     correct = cast_list_of_list_to_sa([[2, 3], [3, 4], [4, 5]],
                                       col_names=['weight', 'age'])
     self.assertTrue(np.array_equal(M, correct))
コード例 #3
0
 def test_fewer_then_n_nonzero_in_col(self):
     M = cast_list_of_list_to_sa(
         [[0,2,3], [0,3,4], [1,4,5]],
         col_names=['height','weight', 'age'])
     arguments = [{'func': fewer_then_n_nonzero_in_col,  'vals': 2}]  
     M = remove_col_where(M, arguments)  
     correct = cast_list_of_list_to_sa(
         [[2,3], [3,4], [4,5]],
         col_names=['weight', 'age'])   
     self.assertTrue(np.array_equal(M, correct))    
コード例 #4
0
 def test_all_same_value(self):
     M = cast_list_of_list_to_sa(
         [[1,2,3], [1,3,4], [1,4,5]],
         col_names=['height','weight', 'age'])
     arguments = [{'func': all_same_value,  'vals': None}]  
     M = remove_col_where(M, arguments)  
     correct = cast_list_of_list_to_sa(
         [[2,3], [3,4], [4,5]],
         col_names=['weight', 'age'])    
     self.assertTrue(np.array_equal(M, correct))