File tree Expand file tree Collapse file tree 1 file changed +12
-13
lines changed Expand file tree Collapse file tree 1 file changed +12
-13
lines changed Original file line number Diff line number Diff line change @@ -7801,32 +7801,31 @@ def interpolate(
7801
7801
1 1.0 2.0 -2.0 5.0
7802
7802
2 2.0 3.0 -3.0 9.0
7803
7803
3 2.0 4.0 -4.0 16.0
7804
+ Using polynomial interpolation.
7805
+
7806
+ >>> df["d"].interpolate(method="polynomial", order=2)
7807
+ 0 1.0
7808
+ 1 4.0
7809
+ 2 9.0
7810
+ 3 16.0
7811
+ Name: d, dtype: float64
7804
7812
7805
7813
Using index method for linear interpolation
7806
7814
with non-sequential index.
7807
- >>> data = {"val": [1, np.nan, 3]}
7808
- >>> df = pd.DataFrame(
7815
+ >>> data_non_seq = {"val": [1, np.nan, 3]}
7816
+ >>> df_non_seq = pd.DataFrame(
7809
7817
... data, index=[0, 1, 6]
7810
7818
... ) # a non-sequential index to demonstrate the difference
7811
- >>> df
7819
+ >>> df_non_seq
7812
7820
val
7813
7821
0 1.0
7814
7822
1 NaN
7815
7823
6 3.0
7816
- >>> df ["val"].interpolate(method="index").round(1)
7824
+ >>> df_non_seq ["val"].interpolate(method="index").round(1)
7817
7825
0 1.0
7818
7826
1 1.3
7819
7827
6 3.0
7820
7828
Name: val, dtype: float64
7821
-
7822
- Using polynomial interpolation.
7823
-
7824
- >>> df["d"].interpolate(method="polynomial", order=2)
7825
- 0 1.0
7826
- 1 4.0
7827
- 2 9.0
7828
- 3 16.0
7829
- Name: d, dtype: float64
7830
7829
"""
7831
7830
inplace = validate_bool_kwarg (inplace , "inplace" )
7832
7831
You can’t perform that action at this time.
0 commit comments