Closed
Description
In [35]: A
Out[35]:
Aattr3 Aattr1 Aattr2
Aidx1
37 Delta East hard
59 Epsilon East hard
96 Zeta East hard
21 Gamma West medium hard
2 Alpha West soft
10 Beta West soft
In [36]: B
Out[36]:
Bname Battr
Bidx1 Bidx2
37 20579 Alan 45.20
59 20693 Betty 4.40
20706 Charlie 9.95
37 20742 Dougal 16.60
96 20861 Emma 7.40
37 21167 Freddy 20.60
59 20947 Gareth 21.00
96 20536 Helen 9.65
37 21002 Ivan 43.80
21 21491 Jenny 6.90
20655 Keith 42.40
2 21083 Leonard 23.60
21391 Mandy 30.40
21381 Nicola 11.60
10 21416 Oswald 30.30
2 21392 Peter 44.40
21386 Quentin 5.40
In [15]: A.index.intersection(B.index)
Out[15]: Index([], dtype=object)
In [9]: pandas.merge(A, B, left_index=True, right_on=['Bidx1'])
...
KeyError: 'no item named Bidx1'
In [10]: pandas.merge(A, B, left_index=True, right_on=['Bidx1',
'Bidx2'])
...
/usr/local/lib/python2.7/dist-packages/pandas-0.7.2.dev_be66c27-py2.7-
linux-x86_64.egg/pandas/tools/merge.pyc in
_validate_specification(self)
278 n = len(self.right_on)
279 if self.left_index:
--> 280 assert(len(self.right_on) ==
self.left.index.nlevels)
281 self.left_on = [None] * n
282 assert(len(self.right_on) == len(self.left_on))
AssertionError:
In [18]: pandas.merge(A, B)
...
/usr/local/lib/python2.7/dist-packages/pandas-0.7.2.dev_be66c27-py2.7-
linux-x86_64.egg/pandas/core/groupby.pyc in
get_group_index(label_list, shape)
1494 return label_list[0]
1495
-> 1496 n = len(label_list[0])
1497 group_index = np.zeros(n, dtype=np.int64)
1498 mask = np.zeros(n, dtype=bool)
IndexError: list index out of range