使用Pandas Python的CSV文件标记化

问题描述

我找不到任何有关如何使用Pandas Python使用csv文件进行标记化的示例代码。以下是我的代码,其中包含经过审核的评论。我将使用此“ cleaned_review”执行令牌化。

enter image description here

解决方法

要在cleaned_review上执行标记化,请将NLTK单词标记化器逐行应用于列。

import nltk
steam_reviews['cleaned_review'] = steam_reviews.apply(lambda row: nltk.word_tokenize(row['cleaned_review']),axis=1)