Skip to content
Advertisement

Insert $ in front of numbers in column using Pandas

I wish to add dollar symbol in front of all the values in my column.

Data

ID  Price
aa  800
bb  2
cc  300
cc  4

Desired

ID  Price
aa  $800
bb  $2
cc  $300
cc  $4

Doing

df.loc["Price"] ='$'+ df["Price"].map('{:,.0f}'.format)

I believe I have to map this, not 100% sure. Any suggestion is appreciated.

Advertisement

Answer

You can also try

df["Price"] = '$' + df["Price"].astype(str)
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement