In Pandas interpolate what is the difference between using method
of slinear
vs index
?
method='slinear' will only interpolate "inside" values. It will not interpolate None values that do not have a valid value on both sides.
Using index values will default to limit_direction='forward' which will interpolate inside values and anything after a non NaN value.
Notice in the other posted example, if you set v to None where either t is 100 or where t is 11 (both ends of the sorted index), the result will not be interpolated when using method='slinear'. This is VERY useful for interpolating values inside a series, when you don't want to extending the series.
Thanks to @TomAugspurger on GitHub for explaining this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With