In [15]:
import pandas as pd
import numpy as np
print "\n\n   Lagrange convergence"
LagrangeTitles = ["Total DoF","R DoF","Soln Time","R-L2","R-order","R-H1","H1-order"]
LagrangeValues = np.concatenate((np.random.randn(5, 1) ,np.random.randn(5, 1),np.random.randn(5, 1),np.random.randn(5, 1),np.random.randn(5, 1),np.random.randn(5, 1),np.random.randn(5, 1)),axis=1)
LagrangeTable= pd.DataFrame(LagrangeValues, columns = LagrangeTitles)
pd.set_option('precision',3)
print LagrangeTable



   Lagrange convergence
   Total DoF  R DoF  Soln Time  R-L2  R-order  R-H1  H1-order
0       0.61  -1.29       0.03  0.11     0.97 -0.90     -1.51
1       0.77  -0.54       0.78 -0.71     0.47 -0.91      1.13
2      -0.44  -1.27       1.06 -0.45    -1.40 -0.21     -0.11
3      -0.12  -1.98       2.07  0.61    -0.02 -1.83     -1.07
4       0.19   0.58       0.96 -1.20     0.84  0.15     -0.04

In [18]:
LagrangeTable['H1-order'] = LagrangeTable['H1-order'].map(lambda x: "%2.2e" %x
                                                          )


---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-18-6c81eddc6147> in <module>()
----> 1 LagrangeTable['H1-order'] = LagrangeTable['H1-order'].map("%2.2e" 
      2                                                           )

/usr/lib/python2.7/dist-packages/pandas/core/series.pyc in map(self, arg, na_action)
   2495             return Series(new_values, index=self.index, name=self.name)
   2496         else:
-> 2497             mapped = map_f(values, arg)
   2498             return Series(mapped, index=self.index, name=self.name)
   2499 

/usr/lib/python2.7/dist-packages/pandas/lib.so in pandas.lib.map_infer (pandas/lib.c:42848)()

TypeError: 'str' object is not callable

In [17]:
print LagrangeTable


   Total DoF  R DoF  Soln Time  R-L2  R-order  R-H1   H1-order
0       0.61  -1.29       0.03  0.11     0.97 -0.90  -1.51e+00
1       0.77  -0.54       0.78 -0.71     0.47 -0.91   1.13e+00
2      -0.44  -1.27       1.06 -0.45    -1.40 -0.21  -1.13e-01
3      -0.12  -1.98       2.07  0.61    -0.02 -1.83  -1.07e+00
4       0.19   0.58       0.96 -1.20     0.84  0.15  -4.43e-02

In [14]:
np.random.randn(5, 1)


Out[14]:
array([[ 0.42902361],
       [ 1.5325213 ],
       [-0.14768592],
       [-0.25026514],
       [-0.57824124]])