示例#1
0
 def test_inner_int_join(self):
     tbl = Tabel({"a": list(range(4)), "b": ['a', 'b'] * 2})
     tbl_b = Tabel({"a": list(range(2, 6)), "c": ['d', 'e'] * 2})
     tbl_j = tbl.join(tbl_b, "a")
     assert "c_r" in tbl_j.columns
     assert tbl_j[0] == (2, 'a', 'd')
     assert len(tbl_j) == 2
     assert np.all(tbl[0] == (0, 'a'))
示例#2
0
 def test_inner_str_join(self):
     tbl = Tabel({"a": list(map(str, range(4))), "b": ['a', 'b'] * 2})
     tbl_b = Tabel({"a": list(map(str, range(4))), "c": ['d', 'e'] * 2})
     tbl_j = tbl.join(tbl_b, "a", jointype="inner")
     assert "c_r" in tbl_j.columns
     assert tbl_j[0] == ('0', 'a', 'd')
     assert len(tbl_j) == 4
     assert np.all(tbl[0] == ('0', 'a'))
示例#3
0
 def test_outer_join(self):
     tbl = Tabel({"a":list(range(4)), "b": ['a','b'] *2})
     tbl_b = Tabel({"a":list(range(2,6)), "c": [1,2] *2, "d":[1.1,2.2]*2})
     tbl_j = tbl.join(tbl_b, "a", jointype='outer')
     naneq(tbl_j[tbl_j['a_l']==0,'c_r'], Tabel.join_fill_value['integer'])
     naneq(tbl_j[tbl_j['a_l']==0, 'd_r'], Tabel.join_fill_value['float'])
     naneq(tbl_j[tbl_j['a_r']==4, 'b_l'], Tabel.join_fill_value['string'])
     assert "c_r" in tbl_j.columns
     assert len(tbl_j) == 6