deerlab.formatted_table#

formatted_table(table, align=None)[source]#

Generate formatted table in string form

This function takes a table as a list of rows, and returns a string representation of the table with automatic formatting. The table is formatted using a row-separator line, a header row, and the data rows.

Parameters:
tablelist of list of objects

The input table, as a list of rows, where each row is a list of objects representing the columns.

alignlist of str, optional

The alignment of the columns in the table. Must be a list of strings, where each string is either ‘<’ for left alignment, ‘>’ for right alignment, or ‘^’ for center alignment. If not provided, all columns will be left-aligned.

Returns:
table2printstr

The formatted table, as a string.