Scikit dendrogram: How to disable ouput?
<p>If I run <code>dendrogram</code> from the scikit libary:</p>

<pre><code>from scipy.cluster.hierarchy import linkage, dendrogram
# ...
X = np.asarray(X)
Z = linkage(X, 'single', 'correlation')
plt.figure(figsize=(16,8))
dendrogram(Z, color_threshold=0.7)
</code></pre>

<p>I get <em>a ton</em> of <code>print</code> output in my ipython notebook:</p>

<pre><code>{'color_list': ['g',
  'r',
  'c',
  'm',
  'y',
   ...
   0.70780175324891315,
   0.70172263980890581],
  [0.0, 0.54342622932769225, 0.54342622932769225, 0.0],
  [0.0, 0.46484932243120658, 0.46484932243120658, 0.0],
  ...
  177,
  196,
  82,
  19,
  108]}
</code></pre>

<p>How can I disable this? I'm only interested in the actual dendrogram.</p>

<p>to redirect print to nothing:</p>

<pre><code>import os
import sys
f = open(os.devnull, 'w')
temp = sys.stdout
sys.stdout = f

# print is disabled here

sys.stdout = temp

# print works again!
</code></pre>

python scikit-learn