# xarray.Dataset.to_dataarray

#### Dataset.to_dataarray(dim='variable', name=None)[[source]](https://github.com/pydata/xarray/blob/main/xarray/core/dataset.py#L7246-L7281)

Convert this dataset into an xarray.DataArray

The data variables of this dataset will be broadcast against each other
and stacked along the first axis of the new array. All coordinates of
this dataset will remain coordinates.

* **Parameters:**
  * **dim** (`Hashable`, *default*: `"variable"`) – Name of the new dimension.
  * **name** (`Hashable` or [`None`](https://docs.python.org/3/builtins/constants.html#None), *optional*) – Name of the new data array.
* **Returns:**
  **array** ([`xarray.DataArray`](xarray.DataArray.html.md#xarray.DataArray))
