Python Forum
How to count value after a textblob - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: How to count value after a textblob (/thread-16918.html)



How to count value after a textblob - LoliMarth - Mar-20-2019

Hello there,

I made a textblob with this piece of code : info = dataextract['Produit'] .apply(lambda x: TextBlob(x).ngrams(3))

My variable Produit -> https://image.noelshack.com/fichiers/2019/12/3/1553071381-capture.png There are more row of course.

I obtained this : https://image.noelshack.com/fichiers/2019/12/3/1553071477-capture1.png

I want to count all the occurence of my values in this list but all I get is 'TypeError: unhashable type: 'list''

So I tried this : tf1 = infoframe.apply(lambda x: pd.value_counts(x))

And I obtained this : https://image.noelshack.com/fichiers/2019/12/3/1553072429-capture2.png

But that's not exactly what I wanted, I want all the occurence for each term in []
Like all the occurence for [Samsung, Galaxy, S8]

I don't know if I'm clear but if you have any idea, don't hesitate to tell me about.

Thanks :)


RE: How to count value after a textblob - micseydel - Mar-22-2019

I haven't looked at your screenshots, but you should be posting: (1) in code tags, full, minimal, runnable code that reproduces your issue and (2) the full stacktrace (your TypeError was in there). The less code you post (assuming it's runnable!), the more likely you are to get a helpful reply and a fast reply.