I have a dataframe with 4 columns. Two columns are numerical, one column is text (tweets) and last column is label (Y/N). I want to convert text column into TF-IDF vector. Code for converting text into TF-TDF vector
from sklearn.feature_extraction.text import TfidfVectorizer
v = TfidfVectorizer()
x = v.fit_transform(df['tweets'])
Now i want to append the return document-term matrix into one of the new column of pandas dataframe, something like this
df['tweetsVect']=x
But this is not working..How to append this to new column of dataframe ?