I've the following dataframe:
CLIENT | AMOUNT
N130 | 1000.50
And want to insert it into an email.
var = df.to_html(header=True, index=False, na_rep="", float_format="{:,}".format)
The problem is that the amount has the format 1,000.50 and what I pretend is the exact opposite 1.000,50.
I've also tried to format the column AMOUNT using .apply but with no success. Can someone help me with this problem. Thanks in advance.
You need to set the locale
import locale
locale.setlocale(locale.LC_ALL, '')
and use the n
in the format:
df.to_html(header=True, index=False, na_rep="", float_format="{:n}".format)
If this does not produce the desired result, change to a different locale
locale.setlocale(locale.LC_ALL, it_IT.UTF-8')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With