larray.asarray
- larray.asarray(a, meta=None) Array [source]
Convert input as Array if possible.
- Parameters
- aarray-like
Input array to convert into an Array.
- metalist of pairs or dict 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
- Array
Examples
>>> # NumPy array >>> np_arr = np.arange(6).reshape((2,3)) >>> asarray(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) >>> asarray(df) {0}\{1} normal reverse a 1.0 3.0 b 2.0 2.0 c 3.0 1.0