I have a Pandas dataframe like this {each row in B is a row with values associated with | symbol}:
A B
a 1|2|3
b 2|4|5
c 3|2|5
I want to create columns that say the value is present on this row (column B) or not:
A B 1 2 3 4 5
a 1|2|3 1 1 1 0 0
b 2|4|5 0 1 0 1 1
c 3|5 0 0 1 0 1
I tried this, sorting through the columns. But can this be done with lambda or understanding?
source
share