Pull requests

#2 Merged
emsrc/python-tabulate-latex python-tabulate-latex
astanin/python-tabulate python-tabulate

Support for numpy record array and latex tabular

  1. Erwin Marsi

I've added support for numpy record arrays, where the headers are derived from the array's field names.

In addition, I've added support for formatting as Latex tabulars. This is a bit of a hack because it doesn't fully fit the tabulate architecture. For example, seems there is no easy way to enforce left alignment of strings (e.g. {r}) and right alignment of floats (e.g. {l}). Anyway, it seems to work for formatting basic tabulars.

  • Learn about pull requests

Comments (1)

  1. Sergey Astanin repo owner

    Thank you for a valuable contribution.

    I was going to add proper LaTeX tabulars in the next major version, as they indeed will require some substantial changes to the library. Supporting NumPy record arrays is a really nice idea.

    Your patches have to be improved to account for the following use cases:

    • headerless tables (headers=[])
    • user-defined headers (headers=["foo", "bar", "baz"])

    I'll take care of supporting LaTeX tabular properly. Could you please update you records array patch e2086c to avoid overriding user-defined headers?