From 443c42f5d2530abc010715ffdd9be90c1d754eb2 Mon Sep 17 00:00:00 2001 From: Advit Arora Date: Thu, 20 Aug 2026 02:27:26 +0530 Subject: [PATCH 1/2] DOC fix kwargs parameter name in curvefit docstrings Both methods take a collecting `kwargs: dict[str, Any] | None = None`, not `**kwargs`, so calling them the way the docstring describes raises TypeError. `xarray/computation/fit.py`, which both delegate to, already spells it correctly. --- xarray/core/dataarray.py | 2 +- xarray/core/dataset.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/xarray/core/dataarray.py b/xarray/core/dataarray.py index c8db4de9226..1c928bc53b0 100644 --- a/xarray/core/dataarray.py +++ b/xarray/core/dataarray.py @@ -6563,7 +6563,7 @@ def curvefit( If 'raise', any errors from the `scipy.optimize_curve_fit` optimization will raise an exception. If 'ignore', the coefficients and covariances for the coordinates where the fitting failed will be NaN. - **kwargs : optional + kwargs : optional Additional keyword arguments to passed to scipy curve_fit. Returns diff --git a/xarray/core/dataset.py b/xarray/core/dataset.py index e98c884db43..d5355eecc72 100644 --- a/xarray/core/dataset.py +++ b/xarray/core/dataset.py @@ -9904,7 +9904,7 @@ def curvefit( If 'raise', any errors from the `scipy.optimize_curve_fit` optimization will raise an exception. If 'ignore', the coefficients and covariances for the coordinates where the fitting failed will be NaN. - **kwargs : optional + kwargs : optional Additional keyword arguments to passed to scipy curve_fit. Returns From dd54f5d6480507e161be3e668858f00444b80e46 Mon Sep 17 00:00:00 2001 From: Advit Arora Date: Thu, 20 Aug 2026 02:27:26 +0530 Subject: [PATCH 2/2] Add whats-new entry --- doc/whats-new.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/doc/whats-new.rst b/doc/whats-new.rst index 0e74ca1e2fc..0b025c4c94d 100644 --- a/doc/whats-new.rst +++ b/doc/whats-new.rst @@ -79,6 +79,11 @@ Documentation - Migrated from nbsphinx/jupyter-execute to myst-nb (:issue:`7924`, :pull:`11456`). By `Nick Hodgskin `_. +- Fixed the ``kwargs`` entry in the :py:meth:`Dataset.curvefit` and + :py:meth:`DataArray.curvefit` docstrings: both take a ``kwargs`` dict, not + ``**kwargs`` (:issue:`6891`). + By `Advit Arora `_. + Internal Changes ~~~~~~~~~~~~~~~~