DataArray.to_dataset(dim=None, *, name=None, promote_attrs=False)[source]#

Convert a DataArray to a Dataset.

  • 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, default: False) – Set to True to shallow copy attrs of DataArray to returned Dataset.


dataset (Dataset)