How to screen print two columns of values from Pandas?
<p>Say I have a distribution which I have loaded in a <code>pandas</code> DataFrame. My data frame consists of 5 columns A to E, and I want to screen print the average and standard deviation next to each other:</p>

<pre><code>avg=df.mean()
stdev=df.std()

Avg                St Dev
A    87.1717       A   1.354
B    87.0517       B   0.789
C    84.1717       C   1.221
D    86.8000       D   3.214
E    84.1705       E   4.170
</code></pre>

<p><strong>How can I do this by playing with the <code>print</code> formats?</strong> I might do the following</p>

<pre><code>print '%-10s' '%s' % ('Avg','St Dev')
print '%-10s' '%s' % (df.mean(),df.std())
</code></pre>

<p>but then only the headers would be correctly displayed, and the values are in a mess:</p>

<pre><code>Avg       St Dev
A    87.1717
B    87.0517
C    84.1717
D    86.8000
E    84.1705
dtype: float64A    1.354
B    0.789
C    1.221
D    3.214
E    4.170
dtype: float64
</code></pre>

<p>My suggestion would be creating a new DataFrame with 2 columns(Avg &amp; St Dev), and then just print the new DataFrame.</p>

python formatting special-characters