I have the following df:
table: A B C D 0 0.000000 0.000000 -0.002520 -0.002520 1 0.20
You can use applymap and assign output back:
table[['A','D']]= table[['A','D']].applymap(format_AD) table[['B','C']]= table[['B','C']].applymap(format_BC) print (table) A B C D 0 0.00% 0.000% -0.003% -0.00% 1 0.21% 0.016% 0.003% 0.02% 2 -0.01% -0.000% 0.000% 0.00%