smpl_doc.doc.array_table

smpl_doc.doc.array_table(arr, top=True, bottom=True, init=True, tabs=1, header=True)[source]

Produces a reST table from a numpy array or normal 2d array.

Parameters

arrnumpy.ndarray, list or dict

2d array or dict

topbool

If True a top line is added.

bottombool

If True a bottom line is added.

initbool

If True a tab is added at the beginning of each line.

tabsint

Number of tabs at the beginning of each line.

headerbool

If True the first row is used as header.

Examples

>>> print(trim_eol_spaces(array_table([["a","b"],["hihi", "hoho"]],tabs=0)))
====== ======
a      b
====== ======
hihi   hoho
====== ======

>>> print(trim_eol_spaces(array_table({"a":["hihi",2],"b": ["hoho",3]},tabs=0,header=False)))
=== ====== ===
a   hihi   2
b   hoho   3
=== ====== ===