Best shown with an example:
>>> x = tabulate.tabulate([[34454634.345], [3.0]], headers=['doesnt work'], floatfmt='17,.4f', tablefmt='simple')
>>> print(x)
doesnt work
----------------------
34,454,634.3450
3.0000
The numbers in the first column aren't aligned by the decimal place.
If I remove the comma (so '17.4f'), it works:
>>> x = tabulate.tabulate([[34454634.345], [3.0]], headers=['doesnt work'], floatfmt='17.4f', tablefmt='simple')
>>> print(x)
doesnt work
-----------------
34454634.3450
3.0000
I believe it's because the regex at https://github.com/astanin/python-tabulate/blob/master/tabulate/__init__.py#L774 does not support whitespace before the number so _isnumber_with_thousands_separator returns False, although _isnumber works fine for numbers left-padded with whitespace
Best shown with an example:
The numbers in the first column aren't aligned by the decimal place.
If I remove the comma (so
'17.4f'), it works:I believe it's because the regex at https://github.com/astanin/python-tabulate/blob/master/tabulate/__init__.py#L774 does not support whitespace before the number so
_isnumber_with_thousands_separatorreturns False, although_isnumberworks fine for numbers left-padded with whitespace