MCPcopy Index your code
hub / github.com/pydata/xarray / rename_dims

Method rename_dims

xarray/core/coordinates.py:828–850  ·  view source on GitHub ↗

Returns a new object with renamed dimensions only. Parameters ---------- dims_dict : dict-like, optional Dictionary whose keys are current dimension names and whose values are the desired names. The desired names must not be the name of an

(
        self,
        dims_dict: Mapping[Any, Hashable] | None = None,
        **dims: Hashable,
    )

Source from the content-addressed store, hash-verified

826 return cast(Self, self.to_dataset().drop_dims(drop_dims, errors=errors).coords)
827
828 def rename_dims(
829 self,
830 dims_dict: Mapping[Any, Hashable] | None = None,
831 **dims: Hashable,
832 ) -> Self:
833 """Returns a new object with renamed dimensions only.
834
835 Parameters
836 ----------
837 dims_dict : dict-like, optional
838 Dictionary whose keys are current dimension names and
839 whose values are the desired names. The desired names must
840 not be the name of an existing dimension or Variable in the Coordinates.
841 **dims : optional
842 Keyword form of ``dims_dict``.
843 One of dims_dict or dims must be provided.
844
845 Returns
846 -------
847 renamed : Coordinates
848 Coordinates object with renamed dimensions.
849 """
850 return cast(Self, self.to_dataset().rename_dims(dims_dict, **dims).coords)
851
852 def rename_vars(
853 self,

Callers 1

test_rename_dimsMethod · 0.95

Calls 1

to_datasetMethod · 0.95

Tested by 1

test_rename_dimsMethod · 0.76