Предположим, что датафрейм выглядит так:
df = pd.DataFrame({'review_body': ['This is review 1', 'This is other review 2', 'this is third review 3']})
print(df)
Результат:
review_body
0 This is review 1
1 This is other review 2
2 this is third review 3
Затем вы можете попробовать выполнить следующее, используя cat
, затем lower
и split
:
result = set(df['review_body'].str.cat(sep=' ').lower().split())
print(result)
Результат:
{'this', 'is', 'third', 'other', '3', 'review', '2', '1'}