我对熊猫有一个很奇怪的问题。你知道吗
在最后一行,我得到一个键错误。熊猫无法取回自我。态度[用户],尽管它应该在前一行设置。你知道吗
有人能告诉我出了什么问题吗?你知道吗
https://sourceforge.net/p/commonground/code/HEAD/tree/CommonGround.py
编辑
def add_document(self,user,uri,document):
"""Calculates the sentiment score, and topic vector for the document,
and updates the users's attitude vector"""
self.Sentiments.loc[(user,uri)]=sum([emotion['compound']
for emotion in (self.vader.polarity_scores(sentence)
for sentence in sentence_splitter.split(document))])
self.Topics.loc[(user,uri),:]=pandas.Series(dict(self.model[self.get_features(document)]))
self.Topics.fillna(0.0,inplace=True)
self.Attitudes.loc[user]=self.Sentiments.loc[user].dot(self.Topics.loc[user])
self.modulus.loc[user]=numpy.linalg.norm(self.Attitudes[user])
self.Sentiments
和self.modulus
是Series
对象。self.Topics
和self.Attitudes
是DataFrame
对象。你知道吗
self.Sentiments
和self.Topics
具有各自的体系索引(每个索引有2个级别)。你知道吗
目前没有回答
相关问题 更多 >
编程相关推荐