Currently facing an issue (data cleaning) of looking at multiple columns in a df that contain the word "food" and then creating a new column named 'food' with the found value
I can search for each specific column however running into issues when searching through the entire dataset (looking at every column and not overriding the previous entry)
s = df['tag_1'].str.contains('food')
df['food'] = df.tag_1.where(s)
Current:
| tag_1 | tag_2 | tag_3 |
|---|---|---|
| placeholder | placeholder | French food |
| British food | placeholder | placeholder |
| placeholder | German food | placeholder |
Ideal:
| tag_1 | tag_2 | tag_3 | food |
|---|---|---|---|
| placeholder | placeholder | French food | French food |
| British food | placeholder | placeholder | British food |
| placeholder | German food | placeholder | German food |