datascience.tables.Table.from_array

classmethod Table.from_array(arr)[source]

Convert a structured NumPy array into a Table.

Args:

arr – A structured NumPy array

Returns:

A table with the field names as the column names and the corresponding data.

Example:

>>> arr = np.array([
...       ('A',1), ('B',2)], 
...       dtype=[('Name', 'U10'), ('Number', 'i4')]
...       )
>>> arr
array([('A', 1), ('B', 2)], dtype=[('Name', '<U10'), ('Number', '<i4')])
>>> t = Table().from_array(arr)
>>> t
Name | Number
A    | 1
B    | 2