title: Converting pandas df containing rownames, columnnames and frequency to Term Document Matrix
body: <p>I have a pandas df in the following format:
   Input :</p>
  
  <pre><code> Freq Document  TermId
    3     A      112
    5     A      055
    1     C      003
    4     D      001
    2     B      003
    1     D      089
  </code></pre>
  
  <p>I want to convert this dataframe to a term document matrix (preferably another pandas df) . What will be the most efficient way of achieving this?</p>
  
  <p>Ex output:</p>
  
  <pre><code>Term/Document  A  B  C  D
      001        0  0  0  4
      003        0  2  1  0
      055        5  0  0  0
      089        0  0  0  1
      112        3  0  0  0
  </code></pre>