I am iterating through a pandas dataframe (originally a csv file) and checking for specific keywords in each row of a certain column. If it appears at least once, I add 1 to a score. There are like 7 keywords, and if the score is >=6, I would like to assign an item of another column (but in this row)
Tag: text-mining
Using Sklearn’s TfidfVectorizer transform
I am trying to get the tf-idf vector for a single document using Sklearn’s TfidfVectorizer object. I create a vocabulary based on some training documents and use fit_transform to train the TfidfVectorizer. Then, I want to find the tf-idf vectors for any given testing document. The problem is that this returns a matrix with n rows where n is the