title: How to print tf-idf scores matrix in sklearn in python
body: <p>I using sklearn to obtain tf-idf values as follows.</p>
  
  <pre><code>from sklearn.feature_extraction.text import TfidfVectorizer
  myvocabulary = ['life', 'learning']
  corpus = {1: "The game of life is a game of everlasting learning", 2: "The unexamined life is not worth living", 3: "Never stop learning"}
  tfidf = TfidfVectorizer(vocabulary = myvocabulary, ngram_range = (1,3))
  tfs = tfidf.fit_transform(corpus.values())
  </code></pre>
  
  <p>Now I want to view my calculated tf-idf scores in a matrix as follows.
  <a href="https://i.stack.imgur.com/mxuEJ.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/mxuEJ.jpg" alt="tf-idf matrix"></a></p>
  
  <p>I tried to do it as follows.</p>
  
  <pre><code>idf = tfidf.idf_
  dic = dict(zip(tfidf.get_feature_names(), idf))
  print(dic)
  </code></pre>
  
  <p>However, then I get the output as follows.</p>
  
  <pre><code>{'life': 1.2876820724517808, 'learning': 1.2876820724517808}
  </code></pre>
  
  <p>Please help me.</p>