diff --git a/doc/whats-new.rst b/doc/whats-new.rst index 7d2b466dd48..72344df4658 100644 --- a/doc/whats-new.rst +++ b/doc/whats-new.rst @@ -17,6 +17,10 @@ New Features Breaking changes ~~~~~~~~~~~~~~~~ +- :py:meth:`Dataset.update` now returns ``None``, instead of the updated dataset. This + completes the deprecation cycle started in version 0.17. The method still updates the + dataset in-place. (:issue:`10167`) + By `Maximilian Roos `_. Deprecations ~~~~~~~~~~~~ diff --git a/xarray/core/dataset.py b/xarray/core/dataset.py index fffe78fa759..a4cf899e687 100644 --- a/xarray/core/dataset.py +++ b/xarray/core/dataset.py @@ -5592,7 +5592,7 @@ def unstack( result = result._unstack_once(d, stacked_indexes[d], fill_value, sparse) return result - def update(self, other: CoercibleMapping) -> Self: + def update(self, other: CoercibleMapping) -> None: """Update this dataset's variables with those from another dataset. Just like :py:meth:`dict.update` this is a in-place operation. @@ -5609,14 +5609,6 @@ def update(self, other: CoercibleMapping) -> Self: - mapping {var name: (dimension name, array-like)} - mapping {var name: (tuple of dimension names, array-like)} - Returns - ------- - updated : Dataset - Updated dataset. Note that since the update is in-place this is the input - dataset. - - It is deprecated since version 0.17 and scheduled to be removed in 0.21. - Raises ------ ValueError @@ -5629,7 +5621,7 @@ def update(self, other: CoercibleMapping) -> Self: Dataset.merge """ merge_result = dataset_update_method(self, other) - return self._replace(inplace=True, **merge_result._asdict()) + self._replace(inplace=True, **merge_result._asdict()) def merge( self,