mlpy.auxiliary.misc.columnize

mlpy.auxiliary.misc.columnize(table_row, justify='R', column_width=0, header=None, sep=None)[source]

Pretty print a table in tabular format a row at a time.

Parameters:

table_row : list or tuple

A row of a table

justify : {“R”, “L”, “C”}, optional

Justification of the columns. Default is “R”.

column_width : int, optional

The width of the column if 0, the column width is determined from the elements in the header and the table row. The column width must be greater than max column width in the table. Default is 0.

header : list or tuple

The header elements for the table. If provided a header is created for the table. Should only be passed in for the first row of the table. Default is None.

sep : str

The separator used for each column. Default is ” ”.

Returns:

out : str

The formatted row.

column_width : int

The maximum width of the column