a=[['1','2'],['3','4']]
b=[['5','6'],['7','8']]
df14=pd.DataFrame({'key':a,'hi':b})
i want to add a 3rd column with tuples, where each list element from 'key' is matched with its list index in 'hi' -> e.g. that it looks like this.
key hi tup
0 [1, 2] [5, 6] [(1,5),(2,6)]
1 [3, 4] [7, 8] [(3,7),(4,8)]
i know that i have to use the zip function, but i cant get thy syntax right.
i think it should be something like
for index,row in df14.iterrows():
df14['tup']=df14.key.apply(lambda x: zip(x,df14.hi))
but this is somehow wrong