fork download
  1. # your code goes here
  2. import pandas as pd
  3. import numpy as np
  4.  
  5. df = pd.DataFrame(np.random.randn(10).reshape(5,2), index =['a','b','c','d','e'], columns = ['one', 'two'])
  6. convert_decimal = lambda x: '{:.1f}'.format(x)
  7. df = df.applymap(convert_decimal)
  8. print(df)
Success #stdin #stdout 0.45s 60880KB
stdin
Standard input is empty
stdout
    one   two
a   0.8  -1.4
b   0.4  -0.7
c  -0.4  -0.7
d   0.9  -0.5
e   0.9  -2.1