File tree Expand file tree Collapse file tree 1 file changed +8
-11
lines changed Expand file tree Collapse file tree 1 file changed +8
-11
lines changed Original file line number Diff line number Diff line change @@ -7802,7 +7802,8 @@ def interpolate(
7802
7802
2 2.0 3.0 -3.0 9.0
7803
7803
3 2.0 4.0 -4.0 16.0
7804
7804
7805
- Using linear and index method for linear interpolation.
7805
+ Using index method for linear interpolation
7806
+ with non-sequential index.
7806
7807
>>> data = {"val": [1, np.nan, 3]}
7807
7808
>>> df = pd.DataFrame(
7808
7809
... data, index=[0, 1, 6]
@@ -7812,16 +7813,12 @@ def interpolate(
7812
7813
0 1.0
7813
7814
1 NaN
7814
7815
6 3.0
7815
- >>> df.interpolate(method="linear")
7816
- val
7817
- 0 1.0
7818
- 1 2.0
7819
- 6 3.0
7820
- >>> df.interpolate(method="index").round(1)
7821
- val
7822
- 0 1.0
7823
- 1 1.3
7824
- 6 3.0
7816
+ >>> df["val"].interpolate(method="index").round(1)
7817
+ 0 1.0
7818
+ 1 1.3
7819
+ 6 3.0
7820
+ Name: val, dtype: float64
7821
+
7825
7822
Using polynomial interpolation.
7826
7823
7827
7824
>>> df["d"].interpolate(method="polynomial", order=2)
You can’t perform that action at this time.
0 commit comments