title: outputting large matrix in python from a dictionary
body: <p>I have a python dictionary formatted in the following way:</p>
  
  <pre><code>data[author1][author2] = 1
  </code></pre>
  
  <p>This dictionary contains an entry for every possible author pair (all pairs of 8500 authors), and I need to output a matrix that looks like this for all author pairs:</p>
  
  <pre><code>        "auth1" "auth2" "auth3" "auth4" ...
  "auth1"    0       1       0       3
  "auth2"    1       0       2       0
  "auth3"    0       2       0       1       
  "auth4"    3       0       1       0
  ...
  </code></pre>
  
  <p>I have tried the following method:</p>
  
  <pre><code>x = numpy.array([[data[author1][author2] for author2 in sorted(data[author1])] for author1 in sorted(data)])
  print x
  outf.write(x)
  </code></pre>
  
  <p>However, printing this leaves me with this:</p>
  
  <pre><code>[[0 0 0 ..., 0 0 0]
   [0 0 0 ..., 0 0 0]
   [0 0 0 ..., 0 0 0]
   ..., 
   [0 0 0 ..., 0 0 0]
   [0 0 0 ..., 0 0 0]
   [0 0 0 ..., 0 0 0]]
  </code></pre>
  
  <p>and the output file is just a blank text file.  I am trying to format the output in a way to read into Gephi (<a href="https://gephi.org/users/supported-graph-formats/csv-format/" rel="nofollow">https://gephi.org/users/supported-graph-formats/csv-format/</a>)</p>