From 1584cc07063b59d4d92ed82236d8c02de7384faa Mon Sep 17 00:00:00 2001 From: milosz-martynow Date: Sun, 13 Nov 2022 16:33:48 +0100 Subject: [PATCH 1/3] DOC: Update interpolation docstring to highlight slinear and spline differences between pandas and scipy. --- pandas/core/generic.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pandas/core/generic.py b/pandas/core/generic.py index 6288ebe77c8c0..a8593a09b65f0 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -7247,12 +7247,15 @@ def interpolate( given length of interval. * 'index', 'values': use the actual numerical values of the index. * 'pad': Fill in NaNs using existing values. - * 'nearest', 'zero', 'slinear', 'quadratic', 'cubic', 'spline', + * 'nearest', 'zero', 'slinear', 'quadratic', 'cubic', 'barycentric', 'polynomial': Passed to - `scipy.interpolate.interp1d`. These methods use the numerical + `scipy.interpolate.interp1d`, whereas 'spline' is assed to + `scipy.interpolate.UnivariateSpline`. These methods use the numerical values of the index. Both 'polynomial' and 'spline' require that you also specify an `order` (int), e.g. - ``df.interpolate(method='polynomial', order=5)``. + ``df.interpolate(method='polynomial', order=5)``. Note that, Scipy + `slinear` method refers to the Scipy first order spline instead + of Pandas first order spline. * 'krogh', 'piecewise_polynomial', 'spline', 'pchip', 'akima', 'cubicspline': Wrappers around the SciPy interpolation methods of similar names. See `Notes`. From d1ce4ca74ec43fe9908b36e841d5c816a00f5272 Mon Sep 17 00:00:00 2001 From: milosz-martynow Date: Mon, 14 Nov 2022 07:41:16 +0100 Subject: [PATCH 2/3] Fix typos. --- pandas/core/generic.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pandas/core/generic.py b/pandas/core/generic.py index a8593a09b65f0..03985c0f373ed 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -7249,13 +7249,13 @@ def interpolate( * 'pad': Fill in NaNs using existing values. * 'nearest', 'zero', 'slinear', 'quadratic', 'cubic', 'barycentric', 'polynomial': Passed to - `scipy.interpolate.interp1d`, whereas 'spline' is assed to + `scipy.interpolate.interp1d`, whereas 'spline' is passed to `scipy.interpolate.UnivariateSpline`. These methods use the numerical values of the index. Both 'polynomial' and 'spline' require that you also specify an `order` (int), e.g. - ``df.interpolate(method='polynomial', order=5)``. Note that, Scipy - `slinear` method refers to the Scipy first order spline instead - of Pandas first order spline. + ``df.interpolate(method='polynomial', order=5)``. Note that, + `slinear` method in Pandas refers to the Scipy first order `spline` instead + of Pandas first order `spline`. * 'krogh', 'piecewise_polynomial', 'spline', 'pchip', 'akima', 'cubicspline': Wrappers around the SciPy interpolation methods of similar names. See `Notes`. From bf44925ddf69ffb2b1c5d5dc25b87cf2a5953f32 Mon Sep 17 00:00:00 2001 From: milosz-martynow Date: Mon, 14 Nov 2022 19:47:50 +0100 Subject: [PATCH 3/3] Shorter docstring comment. --- pandas/core/generic.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandas/core/generic.py b/pandas/core/generic.py index 03985c0f373ed..b90833bda82b5 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -7254,8 +7254,8 @@ def interpolate( values of the index. Both 'polynomial' and 'spline' require that you also specify an `order` (int), e.g. ``df.interpolate(method='polynomial', order=5)``. Note that, - `slinear` method in Pandas refers to the Scipy first order `spline` instead - of Pandas first order `spline`. + `slinear` method in Pandas refers to the Scipy first order `spline` + instead of Pandas first order `spline`. * 'krogh', 'piecewise_polynomial', 'spline', 'pchip', 'akima', 'cubicspline': Wrappers around the SciPy interpolation methods of similar names. See `Notes`.