larray.aslarray

larray.aslarray(a, meta=None)[source]

Converts input as LArray if possible.

Parameters
aarray-like

Input array to convert into a LArray.

metalist of pairs or dict or OrderedDict or Metadata, optional

Metadata (title, description, author, creation_date, …) associated with the array. Keys must be strings. Values must be of type string, int, float, date, time or datetime.

Returns
LArray

Examples

>>> # NumPy array
>>> np_arr = np.arange(6).reshape((2,3))
>>> aslarray(np_arr)
{0}*\{1}*  0  1  2
        0  0  1  2
        1  3  4  5
>>> # Pandas dataframe
>>> data = {'normal'  : pd.Series([1., 2., 3.], index=['a', 'b', 'c']),
...         'reverse' : pd.Series([3., 2., 1.], index=['a', 'b', 'c'])}
>>> df = pd.DataFrame(data)
>>> aslarray(df)
{0}\{1}  normal  reverse
      a     1.0      3.0
      b     2.0      2.0
      c     3.0      1.0