We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 650a981 commit 57c92d3Copy full SHA for 57c92d3
xarray/core/variable.py
@@ -2065,6 +2065,13 @@ def data(self, data):
2065
if not isinstance(self._data, PandasIndexAdapter):
2066
self._data = PandasIndexAdapter(self._data)
2067
2068
+ @Variable.values.setter # type: ignore
2069
+ def values(self, values):
2070
+ raise ValueError(
2071
+ f"Cannot assign to the .values attribute of dimension coordinate a.k.a IndexVariable {self.name!r}. "
2072
+ f"Please use DataArray.assign_coords, Dataset.assign_coords or Dataset.assign as appropriate."
2073
+ )
2074
+
2075
def chunk(self, chunks=None, name=None, lock=False):
2076
# Dummy - do not chunk. This method is invoked e.g. by Dataset.chunk()
2077
return self.copy(deep=False)
0 commit comments