Строки в вашем столбце Genres
должны быть списками тегов. Чтобы иметь возможность работать с этими данными, я бы рекомендовал превратить их в факторы, то есть создать отдельный столбец для каждого тега, который указывает, к каким строкам применяется тег. Вы можете сделать это следующим образом:
import pandas as pd
# small subset of your data for demonstration
df = pd.DataFrame({'Name': ['Sudoku', 'Reversi', 'Morocco'],
'Genres': ['Games, Strategy, Puzzle',
'Games, Strategy, Board',
'Games, Board, Strategy']})
display(df)
Name Genres
0 Sudoku Games, Strategy, Puzzle
1 Reversi Games, Strategy, Board
2 Morocco Games, Board, Strategy
# split each of the strings into a list
df['Genres'] = df['Genres'].str.split(pat=',')
# collect all unique tags from those lists
tags = set(df['Genres'].explode().values)
# create a new Boolean column for each tag
for tag in tags:
df[tag] = [tag in df['Genres'].loc[i] for i in df.index]
display(df)
Name Genres Board Games Puzzle Strategy
0 Sudoku [Games, Strategy, Puzzle] False True True True
1 Reversi [Games, Strategy, Board] True True False True
2 Morocco [Games, Board, Strategy] True True False True
Обратите внимание, что этот код не оптимизирован для скорости. Я просто хотел показать, как это можно сделать.