# xarray.DataArray.from_series

#### *classmethod* DataArray.from_series(series, sparse=False)[[source]](https://github.com/pydata/xarray/blob/main/xarray/core/dataarray.py#L4764-L4795)

Convert a pandas.Series into an xarray.DataArray.

If the series’s index is a MultiIndex, it will be expanded into a
tensor product of one-dimensional coordinates (filling in missing
values with NaN). Thus this operation should be the inverse of the
to_series method.

* **Parameters:**
  * **series** ([`Series`](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Series.html#pandas.Series)) – Pandas Series object to convert.
  * **sparse** ([`bool`](https://docs.python.org/3/builtins/functions.html#bool), *default*: [`False`](https://docs.python.org/3/builtins/constants.html#False)) – If sparse=True, creates a sparse array instead of a dense NumPy array.
    Requires the pydata/sparse package.

#### SEE ALSO
[`DataArray.to_series`](xarray.DataArray.to_series.html.md#xarray.DataArray.to_series), [`Dataset.from_dataframe`](xarray.Dataset.from_dataframe.html.md#xarray.Dataset.from_dataframe)
