I want to merge two tables, A and B. Table A has values in one column, in B these are spread amongst two columns:
A
1 2 3
X X HH
Y D HD
B
1 2
HD NaN
Nan HH
I tried with no success:
newTable = pd.merge(A, B, how='left', left_on = 3, right_on = 1, 2)
The doc speaks of column nameS for left_on and righ_on, so I assume it is possible? How? http://pandas.pydata.org/pandas-docs/dev/merging.html
B[1][pd.isnull(B[1])] = B[2][pd.isnull(B[1])]
- mklnb['1'].combine_first(b['2'])
- Zelazny7max
hack. - DSM