I have one dataframe:
Prefix Value
0 [1, 2]
1 [3,8,9]
2 [4, 5, 6]
I wish to have a new column return the element from the Value column based on Prefix column:
Prefix Value Element
0 [1, 2] 1
1 [3,8,9] 8
2 [4, 5, 6] 6
I have try below code but error:
df["Element"]=df.Value.str[df.Prefix]
ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all()