Open jagerber48 opened 10 months ago
I am facing a similar issue while printing data using tabulate-
File "c:\
pretty_print(
File "c:\
Type of data I am printing -
<class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'> <class 'str'>
fix
I was able to work around this issue fine by setting disable_numparse=True
. I was pretty surprised to see this sort of auto-parsing done by default with an option to suppress this behavior slightly buried in the docs.
I have a custom formatter for floats. One example feature is that I can format floats to be in exponential notation but to always have an exponent that is a multiple of 3 (engineering notation). Right now if I apply this formatter to a table (e.g. list of lists) and then run it through
tabulate
, all of the floats (now strings) will be re-cast as floats and reformatted using the default float format. This is not what I want. In fact, because "float castable stings" get converted back to floats it's actually impossible for me to get what I want. What would be better is if I can pass in a callable function to be used to format floats instead of just a python built-in format specification mini-language specifier