Q:

Pandas dataframe - Formatting certain rows or cells to 2 d.p

With the following dataframe, I would like to reformat the first two rows to 2 decimal places. 
       A         B    C        D     E   F
0     68        45        1843.4    98
1  978.1             23              3    
2                                  
3          49889.2   80              

I have tried methods such as:
df.iloc[0:1,:].style.format("{0:.2f}")

For other projects I would also like to format certain cells, such as col B, index 3 to 49889.20 (2 d.p.), would a similar approach be used for this?
Thanks for any help
Additional Info:
For some context to what I am doing, I am creating a mixed string/float dataframe to be printed via pylatex to LaTeX tex and PDF document (see PDF output below). The pdf prints the actual dataframe, so the PDF shows the dataframe identically as it would output in python. 
I would like to display the values to 2 d.p. as they are financial numbers. Preferably this will be edited in the dataframe, rather than in the pylatex process. i.e. so pylatex simply prints the dataframe. All calculations will have been completed before publishing PDF, so there is no issue turning the values into strings. Thanks. 

A:

Values are changed to strings, but it is possible:
df.iloc[:2] = df.iloc[:2].applymap('{0:.2f}'.format)
print (df)
      A        B      C        D      E    F
0  0.00    68.00  45.00  1843.40  98.00  nan
1  1.00   978.10  23.00     3.00    nan  nan
2     2      NaN    NaN      NaN    NaN  NaN
3     3  49889.2     80      NaN    NaN  NaN

EDIT: For custom function with try-except use:
def func(x):
    try:
        return '{0:.2f}'.format(x)
    except:
        return x

df = df.applymap(func)

