-
Notifications
You must be signed in to change notification settings - Fork 165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix #135. Get rid of exceptions when converting values to numbers. #236
base: master
Are you sure you want to change the base?
Conversation
So, another issue is that ansi color codes are recognized only for floats. Presumably, it doesn't matter for nones, strings and bytes but in case of bools and integers this leads to the same kind of exceptions. >>> print(tabulate([[1000, 1.1],['\033[31m1000\033[0m', '\033[31mTrue\033[0m']], intfmt=','))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\Ibo\Python\python-tabulate\tabulate\__init__.py", line 2176, in tabulate
cols = [
^
File "C:\Users\Ibo\Python\python-tabulate\tabulate\__init__.py", line 2177, in <listcomp>
[_format(v, ct, fl_fmt, int_fmt, miss_v, has_invisible) for v in c]
File "C:\Users\Ibo\Python\python-tabulate\tabulate\__init__.py", line 2177, in <listcomp>
[_format(v, ct, fl_fmt, int_fmt, miss_v, has_invisible) for v in c]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Ibo\Python\python-tabulate\tabulate\__init__.py", line 1231, in _format
return format(val, intfmt)
^^^^^^^^^^^^^^^^^^^
ValueError: Cannot specify ',' with 's'. |
Running into the same issue--can we please get a review for this PR? 🙏 |
Please PR this, I have the same issue here (#289) |
+1 on making this fix. Can we get a review? |
This PR still breaks test_mixed_bools
|
Fix #135
Note: there is (and has been for a while as I understand it) an inconsistency in boolean representation in the columns which contain a mix of bools and numbers. Booleans were passed as text in case of unformatted integer column type, and converted into [0, 1] otherwise. For example:
This behavior is PRESERVED in the current fix, no breaking changes introduced, just "True" and True are handled in the same way now.
This pull request also fixes another issue (see below).