Back

Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
in Python by (120 points)
edited by

I have dictinary for emoji sentiment trying to get sentiment from a csv file

I am getting TypeError: unhashable type: 'list'

Please help me to solve it

tokens = tweets['tokens']
averageChangeInSentiment = [ ]
for e in tokens: #mydata
  if e in emojisentiment: #sentimentdictionary
    if (len(e) > 1):
      emoji_sentiment = emojisentiment.get(t, "")
      averageChangeInSentiment = sum(emoji_sentiments.values())/len(emoji_sentiment.values())

    elif (len(e) == 1):
      emoji_sentiment = emojisentiment.get(t, "")
      averageChangeInSentiment = emoji_sentiment
    elif (len(e) == 0):
      averageChangeInSentiment = 0
tweets['emoji_sentiment'] = averageChangeInSentiment 

Please log in or register to answer this question.

Related questions

0 votes
1 answer
0 votes
2 answers
asked Sep 11, 2019 in Python by Sammy (47.6k points)
0 votes
2 answers
0 votes
1 answer

Browse Categories

...