我正在研究采矿调查数据。我能够标记某些关键字的行:
survey['Rude'] = survey['Comment Text'].str.contains('rude', na=False, regex=True).astype(int)
现在,我想标记任何包含名称的行。我有另一个包含常见美国名称的数据帧。以下是我认为可以工作的内容,但它没有标记任何行,并且我已经验证了名称确实存在于“注释文本”中
for row in survey:
for word in survey['Comment Text']:
survey['Name'] = 0
if word in names['Name']:
survey['Name'] = 1
慕慕森
相关分类