astanin / python-tabulate

Pretty-print tabular data in Python, a library and a command-line utility. Repository migrated from bitbucket.org/astanin/python-tabulate.
https://pypi.org/project/tabulate/
MIT License
2.1k stars 163 forks source link

String "1E10" is incorrectly formatted as float #266

Closed andy-maier closed 1 year ago

andy-maier commented 1 year ago

With tabulate 0.9.0 on Python 3.9:

$ python -c "from tabulate import tabulate; print(tabulate([['1E10']]))"
-----
1e+10
-----

When the value goes beyond a certain limit (the upper limit for 64-bit Python float), it accepts that it is a string:

$ python -c "from tabulate import tabulate; print(tabulate([['1E308']]))"
------
1e+308
------

$ python -c "from tabulate import tabulate; print(tabulate([['1E309']]))"
-----
1E309
-----
andy-maier commented 1 year ago

Ok, I discovered disable_numparse=True, which addresses this. Closing this issue as invalid.