I have the two data frames:
import pandas as pd
rep1 = pd.DataFrame.from_items([('Probe', ['x', 'y', 'z']), ('Gene', ['foo', 'bar', 'qux']), ('RP1',[1.00,23.22,11.12]),('RP1.pacall',["A","B","C"]) ], orient='columns')
pg = rep1[["Probe","Gene"]]
Which produces:
In [105]: rep1
Out[105]:
Probe Gene RP1 RP1.pacall
0 x foo 1.00 A
1 y bar 23.22 B
2 z qux 11.12 C
In [107]: pg
Out[107]:
Probe Gene
0 x foo
1 y bar
2 z qux
What I want to do then is to insert pg into rep1, resulting in:
Probe Gene RP1 Probe Gene RP1.pacall
0 x foo 1.00 x foo G
1 y bar 23.22 y bar I
2 z qux 18.12 z qux K
I tried this but fail:
In [101]: rep1.insert(1,["Probe","Gene"],pg)
TypeError: unhashable type: 'list'
What's the right way to do it?