title: How to put the print information into a current dataframe
body: <p>I am having brain fart.  I wrote some code to get keywords from my data frame.  It worked, but how can I put the print information into my current data frame.  Thank you for the help in advance.</p>
  <pre><code>from scipy.sparse import coo_matrix
  def sort_coo(coo_matrix):
  tuples = zip(coo_matrix.col, coo_matrix.data)
  return sorted(tuples, key=lambda x: (x[1], x[0]), reverse=True)
  
  def extract_topn_from_vector(feature_names, sorted_items, topn=10):
  &quot;&quot;&quot;get the feature names and tf-idf score of top n items&quot;&quot;&quot;
  
   #use only topn items from vector
  sorted_items = sorted_items[:topn]
  
  score_vals = []
  feature_vals = []
  
  # word index and corresponding tf-idf score
  for idx, score in sorted_items:
  
   #keep track of feature name and its corresponding score
      score_vals.append(round(score, 3))
      feature_vals.append(feature_names[idx])
  
   #create a tuples of feature,score
  #results = zip(feature_vals,score_vals)
  results= {}
  for idx in range(len(feature_vals)):
      results[feature_vals[idx]]=score_vals[idx]
  return results
  
  #sort the tf-idf vectors by descending order of scores
  sorted_items=sort_coo(tf_idf_vector.tocoo())
  #extract only the top n; n here is 10
  keywords=extract_topn_from_vector(feature_names,sorted_items,5)
  
  #now print the results -  NEED TO PUT THIS INFORMATION IN MY CURRENT DATAFRAME
  print(&quot;\nAbstract:&quot;)
  print(doc)
  print(&quot;\nKeywords:&quot;)
  for k in keywords:
     print(k,keywords[k])
  </code></pre>