Skip to content

Commit 982d619

Browse files
TYP: Add typing.overload signatures to DataFrame/Series.interpolate (#54999)
* Add inplace overloads for interpolate This will help our type checker work better and is a plain improvement to the type hints. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 31d4d8b commit 982d619

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

pandas/core/generic.py

+45
Original file line numberDiff line numberDiff line change
@@ -7938,6 +7938,51 @@ def replace(
79387938
else:
79397939
return result.__finalize__(self, method="replace")
79407940

7941+
@overload
7942+
def interpolate(
7943+
self,
7944+
method: InterpolateOptions = ...,
7945+
*,
7946+
axis: Axis = ...,
7947+
limit: int | None = ...,
7948+
inplace: Literal[False] = ...,
7949+
limit_direction: Literal["forward", "backward", "both"] | None = ...,
7950+
limit_area: Literal["inside", "outside"] | None = ...,
7951+
downcast: Literal["infer"] | None | lib.NoDefault = ...,
7952+
**kwargs,
7953+
) -> Self:
7954+
...
7955+
7956+
@overload
7957+
def interpolate(
7958+
self,
7959+
method: InterpolateOptions = ...,
7960+
*,
7961+
axis: Axis = ...,
7962+
limit: int | None = ...,
7963+
inplace: Literal[True],
7964+
limit_direction: Literal["forward", "backward", "both"] | None = ...,
7965+
limit_area: Literal["inside", "outside"] | None = ...,
7966+
downcast: Literal["infer"] | None | lib.NoDefault = ...,
7967+
**kwargs,
7968+
) -> None:
7969+
...
7970+
7971+
@overload
7972+
def interpolate(
7973+
self,
7974+
method: InterpolateOptions = ...,
7975+
*,
7976+
axis: Axis = ...,
7977+
limit: int | None = ...,
7978+
inplace: bool_t = ...,
7979+
limit_direction: Literal["forward", "backward", "both"] | None = ...,
7980+
limit_area: Literal["inside", "outside"] | None = ...,
7981+
downcast: Literal["infer"] | None | lib.NoDefault = ...,
7982+
**kwargs,
7983+
) -> Self | None:
7984+
...
7985+
79417986
@final
79427987
def interpolate(
79437988
self,

0 commit comments

Comments
 (0)