Interpolate values between target timestamps according to different methods. The original index is first reindexed to target timestamps (see :meth:`core.resample.Resampler.asfreq`), then the interpolation of ``NaN`` values via :meth:`DataFrame.interpolate` h
(
self,
method: InterpolateOptions = "linear",
*,
axis: Axis = 0,
limit: int | None = None,
limit_direction: Literal["forward", "backward", "both"] = "forward",
limit_area=None,
**kwargs,
)
| 847 | |
| 848 | @final |
| 849 | def interpolate( |
| 850 | self, |
| 851 | method: InterpolateOptions = "linear", |
| 852 | *, |
| 853 | axis: Axis = 0, |
| 854 | limit: int | None = None, |
| 855 | limit_direction: Literal["forward", "backward", "both"] = "forward", |
| 856 | limit_area=None, |
| 857 | **kwargs, |
| 858 | ): |
| 859 | """ |
| 860 | Interpolate values between target timestamps according to different methods. |
| 861 | |
| 862 | The original index is first reindexed to target timestamps |
| 863 | (see :meth:`core.resample.Resampler.asfreq`), |
| 864 | then the interpolation of ``NaN`` values via :meth:`DataFrame.interpolate` |
| 865 | happens. |
| 866 | |
| 867 | Parameters |
| 868 | ---------- |
| 869 | method : str, default 'linear' |
| 870 | Interpolation technique to use. One of: |
| 871 | |
| 872 | * 'linear': Ignore the index and treat the values as equally |
| 873 | spaced. This is the only method supported on MultiIndexes. |
| 874 | * 'time': Works on daily and higher resolution data to interpolate |
| 875 | given length of interval. |
| 876 | * 'index', 'values': use the actual numerical values of the index. |
| 877 | * 'pad': Fill in NaNs using existing values. |
| 878 | * 'nearest', 'zero', 'slinear', 'quadratic', 'cubic', |
| 879 | 'barycentric', 'polynomial': Passed to |
| 880 | `scipy.interpolate.interp1d`, whereas 'spline' is passed to |
| 881 | `scipy.interpolate.UnivariateSpline`. These methods use the numerical |
| 882 | values of the index. Both 'polynomial' and 'spline' require that |
| 883 | you also specify an `order` (int), e.g. |
| 884 | ``df.interpolate(method='polynomial', order=5)``. Note that, |
| 885 | `slinear` method in Pandas refers to the Scipy first order `spline` |
| 886 | instead of Pandas first order `spline`. |
| 887 | * 'krogh', 'piecewise_polynomial', 'spline', 'pchip', 'akima', |
| 888 | 'cubicspline': Wrappers around the SciPy interpolation methods of |
| 889 | similar names. See `Notes`. |
| 890 | * 'from_derivatives': Refers to |
| 891 | `scipy.interpolate.BPoly.from_derivatives`. |
| 892 | |
| 893 | axis : {0 or 'index', 1 or 'columns', None}, default None |
| 894 | Axis to interpolate along. For `Series` this parameter is unused |
| 895 | and defaults to 0. |
| 896 | limit : int, optional |
| 897 | Maximum number of consecutive NaNs to fill. Must be greater than |
| 898 | 0. |
| 899 | limit_direction : {'forward', 'backward', 'both'}, Optional |
| 900 | Consecutive NaNs will be filled in this direction. |
| 901 | |
| 902 | limit_area : {`None`, 'inside', 'outside'}, default None |
| 903 | If limit is specified, consecutive NaNs will be filled with this |
| 904 | restriction. |
| 905 | |
| 906 | * ``None``: No fill restriction. |
nothing calls this directly
no test coverage detected