0

当我跑步时

df=[]
DataTab['scores'] = DataTab['headline_text'].apply(lambda x: vader.polarity_scores(x))
DataTab.head()

我得到这个错误

*---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-248-157ec346f35d> in <module>
      1 df=[]
----> 2 DataTab['scores'] = DataTab['headline_text'].apply(lambda x: vader.polarity_scores(x))
      3 DataTab.head()
~\Anaconda3\lib\site-packages\pandas\core\series.py in apply(self, func, convert_dtype, args, **kwds)
   4040             else:
   4041                 values = self.astype(object).values
-> 4042                 mapped = lib.map_infer(values, f, convert=convert_dtype)
   4043 
   4044         if len(mapped) and isinstance(mapped[0], Series):
pandas\_libs\lib.pyx in pandas._libs.lib.map_infer()
<ipython-input-248-157ec346f35d> in <lambda>(x)
      1 df=[]
----> 2 DataTab['scores'] = DataTab['headline_text'].apply(lambda x: vader.polarity_scores(x))
      3 DataTab.head()
TypeError: polarity_scores() missing 1 required positional argument: 'text'*

请帮助我应该安装或更改什么

4

1 回答 1

0

谢谢你。通过初始化变量然后在 lambda 中使用它来修复它。

于 2021-09-07T10:10:43.463 回答