Python: beautify numerical and dict outputs
<p>I'm doing a loop to output and compare the <code>gof_train</code> and <code>gof_test</code>:</p>

<pre><code>pp.pprint(gof_train)
pp.pprint(gof_test)
</code></pre>

<p>This would give me results like this (in an IPython Notebook):</p>

<pre><code># gof_train
{'Chi_square': 2835.3674597856002,
 'K_S': 0.05029482196934898,
 'MSE': 7.3741561732037447e-08,
 'RMSE / Mean': 0.46193590138914759,
 'RMSE / Mode': 0.050926962892235687,
 'R_square': 0.88494738072721291}
# gof_test
{'Chi_square': 708.90289308802267,
 'K_S': 0.05029482196934898,
 'MSE': 7.3741561732037447e-08,
 'RMSE / Mean': 0.46193590138914759,
 'RMSE / Mode': 0.050926962892235687,
 'R_square': 0.88494738072721291}
</code></pre>

<p>And they are very hard to look at. I'm wondering if there is any way of beautifying the output?</p>

<p>Specifically, I want to shorten the numbers, and make the attributes of these 2 dicts compare with each other. Something like this:</p>

<pre><code>'Chi_square': 2835.3674, 'Chi_square': 708.902,
'K_S': 0.050294,         'K_S': 0.0502,
'R_square': 0.8849,      'R_square': 0.8849
</code></pre>

<hr>

<p><strong>What I've thought</strong></p>

<ol>
<li><p>For numerical output, I think I can try <code>%precision</code>, <a href="http://ipython.org/ipython-doc/2/api/generated/IPython.core.magics.basic.html#IPython.core.magics.basic.BasicMagics.precision" rel="nofollow">http://ipython.org/ipython-doc/2/api/generated/IPython.core.magics.basic.html#IPython.core.magics.basic.BasicMagics.precision</a></p></li>
<li><p>But I don't know any good way of comparing the results. It would be interesting if I can set the <code>css</code> of <code>gof_train</code> and <code>gof_test</code> <code>float: left</code>, but I don't think that's possible.</p></li>
</ol>