Skip to content

Commit 23d67f6

Browse files
committed
Fix issues after review
1 parent 287ca5e commit 23d67f6

File tree

2 files changed

+27
-23
lines changed

2 files changed

+27
-23
lines changed

ci/code_checks.sh

-7
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
116116
-i "pandas.Timestamp.resolution PR02" \
117117
-i "pandas.Timestamp.tzinfo GL08" \
118118
-i "pandas.Timestamp.year GL08" \
119-
-i "pandas.api.types.is_bool PR01,SA01" \
120-
-i "pandas.api.types.is_categorical_dtype SA01" \
121-
-i "pandas.api.types.is_complex PR01,SA01" \
122-
-i "pandas.api.types.is_complex_dtype SA01" \
123-
-i "pandas.api.types.is_datetime64_dtype SA01" \
124-
-i "pandas.api.types.is_datetime64_ns_dtype SA01" \
125-
-i "pandas.api.types.is_datetime64tz_dtype SA01" \
126119
-i "pandas.api.types.is_dict_like PR07,SA01" \
127120
-i "pandas.api.types.is_extension_array_dtype SA01" \
128121
-i "pandas.api.types.is_file_like PR07,SA01" \

pandas/core/arrays/base.py

+27-16
Original file line numberDiff line numberDiff line change
@@ -1022,20 +1022,13 @@ def interpolate(
10221022
of similar names. See Notes.
10231023
* 'from_derivatives': Refers to scipy.interpolate.BPoly.from_derivatives.
10241024
axis : int
1025-
Axis to interpolate along. For 1D NumpyExtensionArray, use 0.
1025+
Axis to interpolate along. For 1-dimensional data, use 0.
10261026
index : Index
10271027
Index to use for interpolation.
10281028
limit : int or None
10291029
Maximum number of consecutive NaNs to fill. Must be greater than 0.
10301030
limit_direction : {'forward', 'backward', 'both'}
10311031
Consecutive NaNs will be filled in this direction.
1032-
* If 'method' is 'pad' or 'ffill', 'limit_direction' must be 'forward'.
1033-
* If 'method' is 'backfill' or 'bfill', 'limit_direction' must be
1034-
'backward'.
1035-
Raises ValueError if limit_direction is 'forward' or 'both' and method
1036-
is 'backfill' or 'bfill'.
1037-
Raises ValueError if limit_direction is 'backward' or 'both' and method
1038-
is 'pad' or 'ffill'.
10391032
limit_area : {'inside', 'outside'} or None
10401033
If limit is specified, consecutive NaNs will be filled with this
10411034
restriction.
@@ -1049,8 +1042,8 @@ def interpolate(
10491042
10501043
Returns
10511044
-------
1052-
NumpyExtensionArray
1053-
A new NumpyExtensionArray with interpolated values.
1045+
ExtensionArray
1046+
An ExtensionArray with interpolated values.
10541047
10551048
See Also
10561049
--------
@@ -1063,23 +1056,41 @@ def interpolate(
10631056
- The 'krogh', 'piecewise_polynomial', 'spline', 'pchip' and 'akima'
10641057
methods are wrappers around the respective SciPy implementations of
10651058
similar names. These use the actual numerical values of the index.
1066-
- For 1D NumpyExtensionArray, use 0 for the `axis` parameter.
10671059
10681060
Examples
10691061
--------
1070-
>>> arr = pd.arrays.NumpyExtensionArray(np.array([0, np.nan, 2, np.nan, 4]))
1062+
Interpolating values in a NumPy array:
1063+
1064+
>>> arr = pd.arrays.NumpyExtensionArray(np.array([0, 1, np.nan, 3]))
1065+
>>> arr.interpolate(
1066+
... method="linear",
1067+
... limit=3,
1068+
... limit_direction="forward",
1069+
... index=pd.Index(range(len(arr))),
1070+
... fill_value=1,
1071+
... copy=False,
1072+
... axis=0,
1073+
... limit_area="inside",
1074+
... )
1075+
<NumpyExtensionArray>
1076+
[0.0, 1.0, 2.0, 3.0]
1077+
Length: 4, dtype: float64
1078+
1079+
Interpolating values in a FloatingArray:
1080+
1081+
>>> arr = pd.array([1.0, pd.NA, 3.0, 4.0, pd.NA, 6.0], dtype="Float64")
10711082
>>> arr.interpolate(
10721083
... method="linear",
10731084
... axis=0,
10741085
... index=pd.Index(range(len(arr))),
10751086
... limit=None,
1076-
... limit_direction="forward",
1087+
... limit_direction="both",
10771088
... limit_area=None,
10781089
... copy=True,
10791090
... )
1080-
<NumpyExtensionArray>
1081-
[0.0, 1.0, 2.0, 3.0, 4.0]
1082-
Length: 5, dtype: float64
1091+
<FloatingArray>
1092+
[1.0, 2.0, 3.0, 4.0, 5.0, 6.0]
1093+
Length: 6, dtype: Float64
10831094
"""
10841095
# NB: we return type(self) even if copy=False
10851096
raise NotImplementedError(

0 commit comments

Comments
 (0)