我是python的新手,当我重新编写一段代码时。我被一个错误卡住了。
text['phrases'] = text['segmanted_text1'].apply(collect_phrases)
total_phrases = text[['airline_id', 'phrases']]
#pick which airline to
phrases = total_phrases[total_phrases['airline_id']==5]
opinion_phrases = process(phrases)
del text, phrases, total_phrases在这里,airline_id不是文本数据帧的一部分。而且,也还没有定义。但是,它是要创建与词组链接的。
对于airline_id,错误返回为未找到索引。
有没有人能告诉我我哪里做错了?
谢谢。
发布于 2020-11-08 19:47:03
使用print查看df包含的文本。
打印(text.columns)
根据您提到的文本,df没有列'airline_id‘,如果您没有列,并且想要添加虚拟数据,只需使用:
航空公司文本‘
_id’= 0
https://stackoverflow.com/questions/64737558
复制相似问题