Skip to content

Commit 48b20ef

Browse files
committed
remove the deprecated return value of Dataset.update
1 parent c6b33e6 commit 48b20ef

File tree

2 files changed

+5
-13
lines changed

2 files changed

+5
-13
lines changed

xarray/core/dataset.py

+2-10
Original file line numberDiff line numberDiff line change
@@ -4157,7 +4157,7 @@ def unstack(
41574157
result = result._unstack_once(dim, fill_value)
41584158
return result
41594159

4160-
def update(self, other: "CoercibleMapping") -> "Dataset":
4160+
def update(self, other: "CoercibleMapping") -> None:
41614161
"""Update this dataset's variables with those from another dataset.
41624162
41634163
Just like :py:meth:`dict.update` this is a in-place operation.
@@ -4173,14 +4173,6 @@ def update(self, other: "CoercibleMapping") -> "Dataset":
41734173
- mapping {var name: (dimension name, array-like)}
41744174
- mapping {var name: (tuple of dimension names, array-like)}
41754175
4176-
Returns
4177-
-------
4178-
updated : Dataset
4179-
Updated dataset. Note that since the update is in-place this is the input
4180-
dataset.
4181-
4182-
It is deprecated since version 0.17 and scheduled to be removed in 0.19.
4183-
41844176
Raises
41854177
------
41864178
ValueError
@@ -4192,7 +4184,7 @@ def update(self, other: "CoercibleMapping") -> "Dataset":
41924184
Dataset.assign
41934185
"""
41944186
merge_result = dataset_update_method(self, other)
4195-
return self._replace(inplace=True, **merge_result._asdict())
4187+
self._replace(inplace=True, **merge_result._asdict())
41964188

41974189
def merge(
41984190
self,

xarray/tests/test_dataset.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -3191,13 +3191,13 @@ def test_update(self):
31913191
data = create_test_data(seed=0)
31923192
expected = data.copy()
31933193
var2 = Variable("dim1", np.arange(8))
3194-
actual = data.update({"var2": var2})
3194+
actual = data
3195+
actual.update({"var2": var2})
31953196
expected["var2"] = var2
31963197
assert_identical(expected, actual)
31973198

31983199
actual = data.copy()
3199-
actual_result = actual.update(data)
3200-
assert actual_result is actual
3200+
actual.update(data)
32013201
assert_identical(expected, actual)
32023202

32033203
other = Dataset(attrs={"new": "attr"})

0 commit comments

Comments
 (0)