Skip to content

Error: TypeError: unhashable type: 'list' #3

Open
@csantanaes

Description

Can i help?

import nltk
a = nltk.FreqDist(HT_regular)
d = pd.DataFrame({'Hashtag': list(a.keys()),
'Count': list(a.values())})

selecting top 20 most frequent hashtags

d = d.nlargest(columns="Count", n = 20)
plt.figure(figsize=(16,5))
ax = sns.barplot(data=d, x= "Hashtag", y = "Count")
ax.set(ylabel = 'Count')
plt.show()


TypeError Traceback (most recent call last)
in ()
1 import nltk
----> 2 a = nltk.FreqDist(HT_regular)
3 d = pd.DataFrame({'Hashtag': list(a.keys()),
4 'Count': list(a.values())})
5

3 frames
/usr/lib/python3.7/collections/init.py in update(*args, **kwds)
653 super(Counter, self).update(iterable) # fast path when counter is empty
654 else:
--> 655 _count_elements(self, iterable)
656 if kwds:
657 self.update(kwds)

TypeError: unhashable type: 'list'

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions