to_html local float_format decimal representation #12445
Labels
IO HTML
read_html, to_html, Styler.apply, Styler.applymap
Output-Formatting
__repr__ of pandas objects, to_string
Usage Question
Hello,
Because of the decimal symbol I'm forced to use the following code. The problem is when the using is "big", for example: 1 356 747 -> 1,35675e+06. Is there any work around?
import locale
loc = locale.getlocale() # get current locale
locale.setlocale(locale.LC_NUMERIC, "Portuguese_Portugal")
html_table = df.to_html(header=True, index=False, na_rep="", float_format="{:n}".format, justify="center")
locale.setlocale(locale.LC_NUMERIC, loc) # restore saved locale
print(html_table)
Code Sample, a copy-pastable example if possible
AMOUNT 1,35675e+06 95 524 179 347 255 691 #### Expected Output AMOUNT 1 356 747 95 524 179 347 255 691 #### output of `pd.show_versions()` ## INSTALLED VERSIONScommit: None
python: 3.5.1.final.0
python-bits: 64
OS: Windows
OS-release: 2012ServerR2
machine: AMD64
processor: Intel64 Family 6 Model 47 Stepping 2, GenuineIntel
byteorder: little
LC_ALL: None
LANG: None
pandas: 0.17.1
nose: None
pip: 8.0.2
setuptools: 20.1.1
Cython: None
numpy: 1.10.4
scipy: 0.17.0
statsmodels: None
IPython: None
sphinx: None
patsy: None
dateutil: 2.4.2
pytz: 2015.7
blosc: None
bottleneck: None
tables: None
numexpr: None
matplotlib: 1.5.1
openpyxl: 2.3.2
xlrd: 0.9.4
xlwt: None
xlsxwriter: 0.8.4
lxml: None
bs4: None
html5lib: None
httplib2: None
apiclient: None
sqlalchemy: None
pymysql: None
psycopg2: None
Jinja2: None
None
The text was updated successfully, but these errors were encountered: