I have the following data that I need to format:
Ativo high close
HTMX11 169.8 169.8
KNHY11 116.0 116.0
FAED11 272.3 272.3
FLRP11 1579.92 1579.92
FVPQ11 215.5 215.5
Need to convert 1579.92 to 1.579,92
not a problem, since I can do with:
import pandas as pd
import locale
locale.setlocale (locale.LC_ALL, 'pt_br.utf-8')
pd.set_option ('display.float_format', lambda x: locale.format ('%. 2f', x, grouping = True))
but when I need to convert the column to a string and add some letters, numbers are kept only with commas:
I need complete formatting.
df['close'] = '$' + df['close'].astype()
df['close']
Results in:
Fechamento
R$ 169,8
R$ 116,0
R$ 272,3
R$ 1579,92
R$ 215,5
desired output:
R$ 1.579,92