首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >更快的熊猫应用modin.pandas

更快的熊猫应用modin.pandas
EN

Stack Overflow用户
提问于 2020-01-11 07:43:08
回答 1查看 570关注 0票数 2

尝试使用modin.pandas来使用此应用函数的所有核心

代码语言:javascript
复制
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会引发以下错误:

代码语言:javascript
复制
ValueError: can not merge DataFrame with instance of type <class 'modin.pandas.series.Series'>

文章是DataFrame中名为"data“的文本列。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-12-15 00:47:40

正如this question的答案所示,您可能会收到此错误,因为您正在将pandas.Dataframemodin.Series合并。对于您的示例,尝试使用datadata转换为使用modin.pandas.DataFrame(data)的modin数据格式。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/59692575

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档