Interpolation (scipy.interpolate)#
There are several general facilities available in SciPy for interpolation and smoothing for data in 1, 2, and higher dimensions. The choice of a specific interpolation routine depends on the data: whether it is one-dimensional, is given on a structured grid, or is unstructured. One other factor is the desired smoothness of the interpolator. In short, routines recommended for interpolation can be summarized as follows:
| kind | routine | continuity | comment | |
|---|---|---|---|---|
| 1D | linear | piecewise continuous | Alternatively,
 | |
| cubic spline | 2nd derivative | |||
| monotone cubic spline | 1st derivative | non-overshooting | ||
| non-cubic spline | (k-1)th derivative | 
 | ||
| nearest | kind=’nearest’, ‘previous’, ‘next’ | |||
| N-D curve | nearest, linear, spline | (k-1)th derivative | use N-dim y array | |
| N-D regular (rectilinear) grid | nearest | method=’nearest’ | ||
| linear | method=’linear’ | |||
| splines | 2nd derivatives | method=’cubic’, ‘quintic’ | ||
| monotone splines | 1st derivatives | method=’pchip’ | ||
| N-D scattered | nearest | alias:  | ||
| linear | ||||
| cubic (2D only) | 1st derivatives | |||
| radial basis function | 
Smoothing and approximation of data#
| 1D spline functions | classic smoothing splines, GCV penalty | |
| automated/semi-automated knot selection | ||
| spine curves in N-D | ||
| unconstrained least squares spline fit | ||
| 2D smoothing surfaces | scattered data | |
| gridded data | ||
| Radial basis functions in N-D | 
Further details are given in the links below
- 1-D interpolation
- Piecewise polynomials and splines
- Smoothing splines
- Multivariate data interpolation on a regular grid  (RegularGridInterpolator)
- Scattered data interpolation (griddata)
- Using radial basis functions for smoothing/interpolation
- Extrapolation tips and tricks
- interp2dtransition guide