Transform decimal number to percentage and integer python

Question:

I have a column that I need to transform its value to percentage.

example
I have the value 0.166978 and I need to transform it into 16.70%

I did it as follows

df['EXAMPLE'] = df[['EXAMPLE']].applymap("{:.4f}%".format)

and got

0.1670%

How do I change these decimal places
to get 16.70%

When I multiply by some value eg 10, 100 it looks like this
0.1670%0.1670%0.1670%0.1670%0.1670%0.1670%0.16…

Asked By: Eric Alves

||

Answers:

try this:

df['EXAMPLE'] = df['EXAMPLE'].apply(lambda row:"{:.2%}".format(float(row))
Answered By: Ahmed Rachid

Maybe you should try this :

df['EXAMPLE'] = (df['EXAMPLE']*100).apply(lambda r:"{:.2%}".format(r))
Answered By: Kiwi
df['EXAMPLE'] = df['EXAMPLE'].apply(lambda row:"{:.2f%}".format(float(row)))