Skip to content

Use Sequence instead of List for drop #46

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions pandas-stubs/core/frame.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -398,39 +398,39 @@ class DataFrame(NDFrame, OpsMixin):
fill_axis: AxisType = ...,
broadcast_axis: Optional[AxisType] = ...,
) -> DataFrame: ...
def reindex(**kwargs) -> DataFrame: ...
def reindex(self, **kwargs) -> DataFrame: ...
@overload
def drop(
self,
labels: Hashable | list[Hashable] = ...,
labels: Hashable | Sequence[Hashable] = ...,
*,
axis: Axis = ...,
index: Hashable | list[Hashable] = ...,
columns: Hashable | list[Hashable] = ...,
index: Hashable | Sequence[Hashable] = ...,
columns: Hashable | Sequence[Hashable] = ...,
level: Optional[Level] = ...,
inplace: Literal[True],
errors: IgnoreRaise = ...,
) -> None: ...
@overload
def drop(
self,
labels: Hashable | list[Hashable] = ...,
labels: Hashable | Sequence[Hashable] = ...,
*,
axis: Axis = ...,
index: Hashable | list[Hashable] = ...,
columns: Hashable | list[Hashable] = ...,
index: Hashable | Sequence[Hashable] = ...,
columns: Hashable | Sequence[Hashable] = ...,
level: Optional[Level] = ...,
inplace: Literal[False] = ...,
errors: IgnoreRaise = ...,
) -> DataFrame: ...
@overload
def drop(
self,
labels: Hashable | list[Hashable] = ...,
labels: Hashable | Sequence[Hashable] = ...,
*,
axis: Axis = ...,
index: Hashable | list[Hashable] = ...,
columns: Hashable | list[Hashable] = ...,
index: Hashable | Sequence[Hashable] = ...,
columns: Hashable | Sequence[Hashable] = ...,
level: Optional[Level] = ...,
inplace: bool = ...,
errors: IgnoreRaise = ...,
Expand Down
2 changes: 2 additions & 0 deletions tests/test_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,8 @@ def test_types_drop() -> None:
res6: pd.DataFrame = df.drop(index=1)
res7: pd.DataFrame = df.drop(labels=0)
res8: None = df.drop([0, 0], inplace=True)
to_drop: List[str] = ["col1"]
res9: pd.DataFrame = df.drop(columns=to_drop)


def test_types_dropna() -> None:
Expand Down