title: How to load a numpy condensed matrix into a pandas DataFrame
body: <p>I used <code>scipy.spatial.distance.pdist</code> to calcaulate the distances among indexes of a pandas DataFrame, and as a result it returned me a condensed matrix as a <code>numpy.ndarray</code>.</p>
  <p>I understand how a condensed matrix works (the top/bottom triangle of a matrix) and managed to load it into a DataFrame by iterating through all DataFrame cells and inserting the respective condensed matrix value.</p>
  <p>The problem is that I am calculating the distance among 83.803 boolean vectors, and the result is quite big, which makes difficult to go through all the cells of a 83.803 vs 83.803 matrix and insert its values. Keeping it in mind I would like to know if there isn't any &quot;more intelligent&quot; way to do it! I started working with pandas a couple of weeks ago and realized that its philosophy is to avoid iterating through cells and deal with it as a whole, and that's why I imagine that there is a simple way to load condensed matrices directly.</p>
  <p>I am trying to use the <code>scipy.spatial.distance.squareform</code> function but it always returns the same error</p>
  <blockquote>
  <p>Segmentation fault (core dumped)</p>
  </blockquote>
  <p>Here is the code:</p>
  <pre><code>&gt;&gt;&gt; import pandas as pd
  &gt;&gt;&gt; from scipy.spatial import distance
  
  &gt;&gt;&gt; content = pd.read_table('proteobacteria-gene_content.tab')
  &gt;&gt;&gt; content = content.set_index('Species_name')
  &gt;&gt;&gt; content = content.T
  &gt;&gt;&gt; content
  &lt;class 'pandas.core.frame.DataFrame'&gt;
  Index: 83803 entries, Proteo_1 to Proteo_83803
  Columns: 468 entries, Methylomonas_methanica to Glaciecola_sp
  dtypes: int64(468)
  
  &gt;&gt;&gt; j_distances = distance.pdist(content, metric='jaccard')
  &gt;&gt;&gt; matrix = distance.squareform(j_distances)
  Segmentation fault (core dumped)
  </code></pre>