Reputation: 4408
I wish to add dollar symbol in front of all the values in my column.
ID Price
aa 800
bb 2
cc 300
cc 4
ID Price
aa $800
bb $2
cc $300
cc $4
df.loc["Price"] ='$'+ df["Price"].map('{:,.0f}'.format)
I believe I have to map this, not 100% sure. Any suggestion is appreciated.
Upvotes: 0
Views: 549
Reputation: 521864
We could use str.replace
here:
df["Price"] = df["Price"].astype(str).str.replace(r'^', '$', regex=True)
Upvotes: 1