Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to convert float to currency(US dollar) in a data frame?

my data frame looks like this

How to convert decimal value to US dollar in pandas?

For instance 8.301400 should be $8,30,1400

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

df['column'] = df['column'].apply(lambda x: f"${x*100000:,.2f}")

I think 100000 is the multiplier, but if it’s another one just change it above.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading