Skip to content

tabulate.tabulate([['126,000']], tablefmt="html") raises error starting in 0.8.8 #110

@tomhennigan

Description

@tomhennigan

Starting in 0.8.8 we're seeing errors when converting to HTML with large numbers encoded as strings:

import tabualate
tabulate.tabulate([['126,000']], tablefmt="html")

Error:

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-2-37ea0f4d62eb> in <module>()
      1 import tabulate
      2 print(tabulate.__version__)
----> 3 tabulate.tabulate([['126,000']], tablefmt="html")

3 frames
/usr/local/lib/python3.6/dist-packages/tabulate.py in _format(val, valtype, floatfmt, missingval, has_invisible)
   1002             return val.replace(raw_val, formatted_val)
   1003         else:
-> 1004             return format(float(val), floatfmt)
   1005     else:
   1006         return "{0}".format(val)

ValueError: could not convert string to float: '126,000'

This works in previous versions of tabulate, see https://colab.research.google.com/gist/tomhennigan/55ffecb257911296cf181ae968a7356a/tabulate-0-8-8-bug.ipynb for an example.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions