'Changing column value according to a comparison rule
I have this DataFrame:
classification text apple banana peach grape
["apple","grape"] anytext NaN NaN NaN NaN
How can I check if the column name is in the classification column, to get this:
classification text apple banana peach grape
["apple","grape"] anytext 1 0 0 1
Data:
{'classification': [['apple', 'grape']],
'text': ['anytext'],
'apple': [nan],
'banana': [nan],
'peach': [nan],
'grape': [nan]}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
