xarray.DataArray.to_dataset

DataArray.to_dataset(self, dim: Union[Hashable, NoneType] = None, name: Union[Hashable, NoneType] = None) → xarray.core.dataset.Dataset

Convert a DataArray to a Dataset.

Parameters
dimhashable, 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.

namehashable, optional

Name to substitute for this array’s name. Only valid if dim is not provided.

Returns
datasetDataset