to_dataset

UnitsAwareDataArray.to_dataset(dim: Hashable = None, *, name: Hashable = None, promote_attrs: bool = False) Dataset

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

Returns:

dataset

Return type:

Dataset