尝试使用modin.pandas来使用此应用函数的所有核心
from nltk.sentiment.vader import SentimentIntensityAnalyzer
sid = SentimentIntensityAnalyzer()
# sentiment Score of essay
data = data.merge(data.essay.apply(lambda s: pd.Series({'neg':sid.polarity_scores(s)['neg'],
'neu':sid.polarity_scores(s)['neu'],
'pos':sid.polarity_scores(s)['pos'],
'compound':sid.polarity_scores(s)['compound']})),
left_index=True, right_index=True)它适用于默认的熊猫,但使用modin会引发以下错误:
ValueError: can not merge DataFrame with instance of type <class 'modin.pandas.series.Series'>文章是DataFrame中名为"data“的文本列。
发布于 2021-12-15 00:47:40
正如this question的答案所示,您可能会收到此错误,因为您正在将pandas.Dataframe与modin.Series合并。对于您的示例,尝试使用data将data转换为使用modin.pandas.DataFrame(data)的modin数据格式。
https://stackoverflow.com/questions/59692575
复制相似问题