larray.aslarray

larray.aslarray(a)[source]

Converts input as LArray if possible.

Parameters:

a : array-like

Input array to convert into a LArray.

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