A subclass of list whose purpose is to store labels and
formatting information for a list of 1-dimensional structured
arrays. It also provides pretty-printing routines.
Globally, the table has a default display length for the columns
and a table header.
A column can have a column-specific header.
A subcolumn wraps the data found under a given field name. Each
subcolumn has a label and a display width.
:param l: List of 1-dimensional structured arrays.
:type l: list
:param table_header: The title of the object. Default is `None`.
:type table_header: string, optional
:param compact_view: If `True` the DataTable is displayed with its
tokens only without the probabilities. Default is `True`
:type compact_view: boolean, optional
:attributes:
* **table_header** (string)
The title of the object. Default is `None`.
* **compact_view** (boolean)
Option of viewing tokens with or without the probabilities.
:methods:
* **__str__**
Returns a pretty printed string version of the object.
* **_repr_html_**
Returns an html table in ipython online session.
**Examples**
>>> words = ['there','will','be','an','answer']
>>> values = [random.random() for w in words]
>>> arr = np.array(zip(words, values),
dtype=[('i', np.array(words).dtype),
('value', np.array(values).dtype)])
>>> lc = LabeledColumn(arr, 'Lyrics')
>>> l = [lc.copy() for i in xrange(2)]
>>> dt = DataTable(l, 'Let it be', subcolhdr_compact=['Topic', 'Words'],
subcolhdr_full=['Word', 'Prob'], compact_view=True)
>>> print dt
--------------------------------------------
Let it be
--------------------------------------------
Topic Words
--------------------------------------------
Lyrics there will be
an answer
--------------------------------------------
Lyrics there will be
an answer
--------------------------------------------
>>> dt.compact_view = False
>>> print dt
Let it be
---------------------
Words
---------------------
Word Value
---------------------
there 0.58793
will 0.29624
be 0.00209
an 0.27221
answer 0.96118
---------------------
Words
---------------------
Word Value
---------------------
there 0.22608
will 0.64567
be 0.02832
an 0.31118
answer 0.23083