def filtering_test(): arr = np.array([ [0.2, 0.3, 0.4], [0.1, 0.3, 0.6], [0.6, 0.3, 0.6]]) cols = ['a','b','c'] index = ['one','two','three'] name = 'test_table' t = Table(arr, cols, index, name) # filter by equality t2 = t.filter_on_column('c',0.6) arr2 = np.array([ [0.1, 0.3, 0.6], [0.6, 0.3, 0.6]]) cols2 = ['a','b','c'] index2 = ['two','three'] name2 = 'test_table' assert(t2.shape == arr2.shape and np.all(t2.arr == arr2) and t2.cols == cols2 and t2.index == index2 and t2.name == name2) # filter by < 0.6 t2 = t.filter_on_column('c',0.6,operator.lt) arr2 = np.array([ [0.2, 0.3, 0.4]]) cols2 = ['a','b','c'] index2 = ['one'] name2 = 'test_table' assert(t2.shape == arr2.shape and np.all(t2.arr == arr2) and t2.cols == cols2 and t2.index == index2 and t2.name == name2) # filter by < 0.6 and omit column t2 = t.filter_on_column('c',0.6,operator.lt,omit=True) arr2 = np.array([ [0.2, 0.3]]) cols2 = ['a','b'] index2 = ['one'] name2 = 'test_table' assert(t2.shape == arr2.shape and np.all(t2.arr == arr2) and t2.cols == cols2 and t2.index == index2 and t2.name == name2)