0

I am trying to implement tf-idf without using sklearn and similar packages. Can someone help me convert values in a DataFrame to a list of blob objects?

I have a DataFrame with one column- "Text" and I want a bloblist as [TextBlob(Text1),TextBlob(Text2),...,TextBlob(Textn)] [find image here]1

I tried: bloblist=TextBlob(str(df["text"].values)) but this gives me just one list like TextBlob(0 Text1,0 Text2,...0 Textn)

Is there a way to eliminate these preceding 0's...or is there a better way

Could someone please point out where I am wrong.

Prithvi
  • 43
  • 6
  • Hmmm, maybe help [this](http://stackoverflow.com/q/37593293/2901002) – jezrael Apr 20 '17 at 07:10
  • I would like to avoid using sklearn package. – Prithvi Apr 20 '17 at 07:12
  • 1
    @ChandaKorat You seem to be adding the [tag:dataframe] tag to a lot of posts. Please be aware that mass tagging should only be performed by users with 2000+ reputation points, and coordinated via a [meta] question with a consensus answer. – tripleee Apr 20 '17 at 13:50
  • See also https://meta.stackoverflow.com/questions/314488/how-to-deal-with-serial-tag-only-edits-from-sub-2k-users – tripleee Apr 20 '17 at 13:55

1 Answers1

0

This has nothing to do with calculating tf-idf values, but here is a way to get a list of TextBlob objects.

[TextBlob(t) for t in df.text.values]
Gijs
  • 10,346
  • 5
  • 27
  • 38
  • This just returns me one TextBlob object with all the 'text'...[TextBlob("Text1","Text2",..."Textn")]. – Prithvi Apr 20 '17 at 20:56
  • This will always return a list. If there is one item in it, then there is also only one row in the dataframe. Can you include a table showing the structure of your dataframe? – Gijs Apr 20 '17 at 21:00