title: ValueError: Iterable over raw text documents expected, string object received
body: <p>Trying to identify the weight value of a using <code>TFIDF</code> and <code>count vectorizer</code></p>
  
  <p>Below code works fine when I execute that individually for each row. It throws an error adding a loop or using a function.</p>
  
  <pre><code>function and tried using a lambda function 
  def t_keywo(text):
      tf_idf_vector=tfidf_transformer.transform(cv.transform(text))
      #sort the tf-idf vectors by descending order of scores
      sorted_items=sort_coo(tf_idf_vector.tocoo())
      keywords=extract_topn_from_vector(feature_names,sorted_items)
  
      return keywords
  
  for loop 
  
  for i in range(len(df_cs_l)):
      tf_idf_vector=tfidf_transformer.transform(cv.transform(df_cs_l[i]))
      #sort the tf-idf vectors by descending order of scores
      sorted_items=sort_coo(tf_idf_vector.tocoo())
      keywords=extract_topn_from_vector(feature_names,sorted_items)
      ref={'Text':i,'words': keywords}
      rel.append(ref)
  
  
  </code></pre>
  
  <p>when I executed the above code it throws me below error</p>
  
  <p><code>Error: "ValueError: Iterable over raw text documents expected, string object received."</code></p>
  
  <p>have seen the same error in below link </p>
  
  <p><a href="https://discuss.datasciencedojo.com/t/error-iterable-over-raw-text-documents-expected-string-object-received-tfidf-vectorizer/614" rel="nofollow noreferrer">clicl here to view the example</a></p>