larray.from_series

larray.from_series(s, sort_rows=False, fill_value=nan, meta=None, copy=True, **kwargs) Array[source]

Convert Pandas Series into Array.

Parameters:
sPandas Series

Input Pandas Series.

sort_rowsbool, optional

Whether to sort the rows alphabetically. Defaults to False.

fill_valuescalar, optional

Value used to fill cells corresponding to label combinations which are not present in the input Series. Defaults to NaN.

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.

copybool, optional

Whether to copy the data from the Series. Defaults to True. copy=False does not guarantee that no copy will be made, only that a copy is only done when necessary. If the resulting array shares the same data buffer than the original series, it will be read-only.

Returns:
Array

See also

Array.to_series

Examples

>>> from larray import ndtest
>>> s = ndtest((2, 2, 2), dtype=float).to_series()
>>> s
a   b   c
a0  b0  c0    0.0
        c1    1.0
    b1  c0    2.0
        c1    3.0
a1  b0  c0    4.0
        c1    5.0
    b1  c0    6.0
        c1    7.0
dtype: float64
>>> from_series(s)
 a  b\c   c0   c1
a0   b0  0.0  1.0
a0   b1  2.0  3.0
a1   b0  4.0  5.0
a1   b1  6.0  7.0