Skip to content

Commit

Permalink
TYP: Add typing.overload signatures to DataFrame/Series.interpolate (#…
Browse files Browse the repository at this point in the history
…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>
  • Loading branch information
caneff and pre-commit-ci[bot] authored Sep 4, 2023
1 parent 31d4d8b commit 982d619
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -7938,6 +7938,51 @@ def replace(
else:
return result.__finalize__(self, method="replace")

@overload
def interpolate(
self,
method: InterpolateOptions = ...,
*,
axis: Axis = ...,
limit: int | None = ...,
inplace: Literal[False] = ...,
limit_direction: Literal["forward", "backward", "both"] | None = ...,
limit_area: Literal["inside", "outside"] | None = ...,
downcast: Literal["infer"] | None | lib.NoDefault = ...,
**kwargs,
) -> Self:
...

@overload
def interpolate(
self,
method: InterpolateOptions = ...,
*,
axis: Axis = ...,
limit: int | None = ...,
inplace: Literal[True],
limit_direction: Literal["forward", "backward", "both"] | None = ...,
limit_area: Literal["inside", "outside"] | None = ...,
downcast: Literal["infer"] | None | lib.NoDefault = ...,
**kwargs,
) -> None:
...

@overload
def interpolate(
self,
method: InterpolateOptions = ...,
*,
axis: Axis = ...,
limit: int | None = ...,
inplace: bool_t = ...,
limit_direction: Literal["forward", "backward", "both"] | None = ...,
limit_area: Literal["inside", "outside"] | None = ...,
downcast: Literal["infer"] | None | lib.NoDefault = ...,
**kwargs,
) -> Self | None:
...

@final
def interpolate(
self,
Expand Down

0 comments on commit 982d619

Please sign in to comment.