One function

_normalize_tabular_data in astanin/python-tabulate

The author described this change as fix #22: allow numbers as column headers. It counts as a record because the check below fails on the code as it stood at ddfb6a75b and passes on 281c0e639, with nothing else changed between the two runs.

Fix saved2014-02-12
Sharing licenceMIT · LICENSE
Change size+1 1

What the code was meant to do, written into the code itself as a docstring

Transform a supported data type to a list of lists, and a list of headers. Supported tabular data types: * list-of-lists or another iterable of iterables * list of named tuples (usually used with headers="keys") * list of dicts (usually used with headers="keys") * list of OrderedDicts (usually used with headers="keys") * 2D NumPy arrays * NumPy record arrays (usually used with headers="keys") * dict of iterables (usually used with headers="keys") * pandas.DataFrame (usually used with headers="keys") The first row can be used as headers if headers="firstrow", column indices can be used as headers if headers="keys".

The change

8787 headers = list(map(_text_type, rows[0])) # headers should be strings
8888 rows = rows[1:]
8989
90- headers = list(headers)
90+ headers = list(map(_text_type,headers))
9191 rows = list(map(list,rows))
9292
9393 # pad with empty headers for initial columns if necessary

The check that tells the two apart

failpass·test/test_regression.py::test_numeric_column_headers

Check file test/test_regression.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.

Origin and history

The code before itddfb6a75b7ca896d8f01afd9ac62886f0f7c6c3e
Broken version dated2014-02-12
Moduletabulate
Units changed_normalize_tabular_data
Fingerprint24daa6994e44ca87
Checked2026-08-18 by goldset/0.1

Every field above is generated by our program. None of it is written by hand.

Other bugs found in astanin/python-tabulate