Skip to content

Commit

Permalink
fix signature of frame.filter
Browse files Browse the repository at this point in the history
items can be ListLike
  • Loading branch information
refack committed Aug 1, 2024
1 parent 458ecb4 commit fe2af1d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pandas-stubs/core/frame.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -1711,7 +1711,7 @@ class DataFrame(NDFrame, OpsMixin):
) -> DataFrame: ...
def filter(
self,
items: list | None = ...,
items: ListLike | None = ...,
like: _str | None = ...,
regex: _str | None = ...,
axis: Axis | None = ...,
Expand Down
2 changes: 2 additions & 0 deletions tests/test_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,8 @@ def test_types_filter() -> None:
df.filter(items=["col1"])
df.filter(regex="co.*")
df.filter(like="1")
# [PR 964] Docs state `items` is `list-like`
df.filter(items=("col2", "col2", 1, tuple([4])))


def test_types_setting() -> None:
Expand Down

0 comments on commit fe2af1d

Please sign in to comment.