A subclass of np.ndarray whose purpose is to store labels and
formatting information for a 1-dimensional structured array. It
also provides pretty-printing routines.
A column can have a header and a default display length.
A subcolumn wraps the data found under a given field name. Each
subcolumn has a label and a display width.
:param input_array: Array to be formatted into a LabeledColumn.
:type input_array: 1-dimensional structured array
:param col_header: The title of the object. For example, 'Words: logic'.
Default is `None`.
:type col_header: string, optional
:param subcol_headers: List of labels that correspond to the fields of
the structured array. Default is `None`.
:type subcol_headers: list, optional
:param subcol_widths: List of widths for each subcolumn. If not provided,
`subcol_widths` is calculated based on the data-type of the entries.
:type subcol_widths: list, optional
:param col_len: Number of entries to display. If not provided, `col_len`
is set to length of LabeledColumn.
:type col_len: integer, optional
:param multi_col: If `True` html table version of :class:`LabeledColumn`
is displayed in multiple columns when the number of entries exceed 15.
Default is `True`.
:type multi_col: boolean, optional
:attributes:
* **col_header** (string, optional)
The title of the object. For example, 'Words: logic'.
Default is `None`.
* **subcol_headers** (list, optional)
List of labels that correspond to the fields of
the structured array. Default is `None`.
* **subcol_widths** (list, optional)
List of widths for each subcolumn. If not provided,
`subcol_widths` is calculated based on the data-type of the entries.
* **col_len** (integer, optional)
Number of entries to display. If not provided, `col_len`
is set to length of LabeledColumn.
:methods:
* **__str__**
Returns a pretty printed string version of the object.
* **_repr_html_**
Returns a 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)
>>> lc.col_header = 'Words'
>>> lc.subcol_headers = ['Word', 'Value']
>>> lc.subcol_widths
[11, 10]
>>> lc.col_len
5
>>> print lc
Words
---------------------
Word Value
---------------------
there 0.22608
will 0.64567
be 0.02832
an 0.31118
answer 0.23083