# xarray.DataArray.to_dataset

#### DataArray.to_dataset(dim=None, , name=None, promote_attrs=False)[[source]](https://github.com/pydata/xarray/blob/main/xarray/core/dataarray.py#L776-L816)

Convert a DataArray to a Dataset.

* **Parameters:**
  * **dim** (`Hashable`, *optional*) – Name of the dimension on this array along which to split this array
    into separate variables. If not provided, this array is converted
    into a Dataset of one variable.
  * **name** (`Hashable`, *optional*) – Name to substitute for this array’s name. Only valid if `dim` is
    not provided.
  * **promote_attrs** ([`bool`](https://docs.python.org/3/builtins/functions.html#bool), *default*: [`False`](https://docs.python.org/3/builtins/constants.html#False)) – Set to True to shallow copy attrs of DataArray to returned Dataset.
* **Returns:**
  **dataset** ([`Dataset`](xarray.Dataset.html.md#xarray.Dataset))
