天天看点

tfidf里面遇到的‘list’ object has no attribute 'lower'问题

  • 出现问题
  • TfidfVectorizer对象实例化的时候
  • fit时候的数据出现问题
    tfidf里面遇到的‘list’ object has no attribute 'lower'问题
    tfidf里面遇到的‘list’ object has no attribute 'lower'问题
  • 可以看到test(数据)是list套list,而所需要的数据是可迭代对象里面为str
  • 改成[‘是要 申报… 谢谢你’,‘xx xx xx’,’’…]这种形式
  • 把里面的[]去掉,取出来改为str类型即可解决这个问题