title: Setting number of decimals in dataframe for a calculated value
body: <p>I would like to set the precision of the mean value in a dataframe, but I get the following error: TypeError: cannot convert the series to &lt;class 'float'&gt;</p>
  <p>I set the arrays as dtype=float. It works if I remove &quot;%.2f&quot;%, but gives more decimal points than I want.</p>
  <p>Following is the code:</p>
  <pre><code>import numpy as np
  import pandas as pd
  df = pd.DataFrame(np.array([[0, 0.030, 0.031, 0.032], [10, 0.153, 0.155, 0.154], [20, 0.393, 0.397, 0.395]]), columns=['Y0','Y1', 'Y2', 'Y3'], dtype=float)
  Xa=df.loc[:,&quot;Y1&quot;:]
  mean=Xa.mean(axis=1)
  df['mean']=&quot;%.2f&quot;%mean
  df
  </code></pre>