Skip to content
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

DOCS: fix docstring validation errors for groupby.DataFrameGroupBy.filter, groupby.SeriesGroupBy.filter #59742

Merged
merged 7 commits into from
Sep 9, 2024
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
2 changes: 0 additions & 2 deletions ci/code_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
-i "pandas.core.groupby.DataFrameGroupBy.agg RT03" \
-i "pandas.core.groupby.DataFrameGroupBy.aggregate RT03" \
-i "pandas.core.groupby.DataFrameGroupBy.boxplot PR07,RT03,SA01" \
-i "pandas.core.groupby.DataFrameGroupBy.filter SA01" \
-i "pandas.core.groupby.DataFrameGroupBy.get_group RT03,SA01" \
-i "pandas.core.groupby.DataFrameGroupBy.groups SA01" \
-i "pandas.core.groupby.DataFrameGroupBy.hist RT03" \
Expand All @@ -179,7 +178,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
-i "pandas.core.groupby.SeriesGroupBy.__iter__ RT03,SA01" \
-i "pandas.core.groupby.SeriesGroupBy.agg RT03" \
-i "pandas.core.groupby.SeriesGroupBy.aggregate RT03" \
-i "pandas.core.groupby.SeriesGroupBy.filter PR01,SA01" \
-i "pandas.core.groupby.SeriesGroupBy.get_group RT03,SA01" \
-i "pandas.core.groupby.SeriesGroupBy.groups SA01" \
-i "pandas.core.groupby.SeriesGroupBy.indices SA01" \
Expand Down
18 changes: 15 additions & 3 deletions pandas/core/groupby/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -600,15 +600,23 @@ def filter(self, func, dropna: bool = True, *args, **kwargs):
----------
func : function
Criterion to apply to each group. Should return True or False.
dropna : bool
dropna : bool, optional
Drop groups that do not pass the filter. True by default; if False,
groups that evaluate False are filled with NaNs.
*args : tuple
Optional positional arguments to pass to `func`.
**kwargs : dict
Optional keyword arguments to pass to `func`.

Returns
-------
Series
The filtered subset of the original Series.

See Also
--------
DataFrameGroupBy.filter : Filter elements from groups base on criterion.

Notes
-----
Functions that mutate the passed object can produce unexpected
Expand Down Expand Up @@ -1943,16 +1951,20 @@ def filter(self, func, dropna: bool = True, *args, **kwargs) -> DataFrame:
dropna : bool
Drop groups that do not pass the filter. True by default; if False,
groups that evaluate False are filled with NaNs.
*args
*args : tuple
Additional positional arguments to pass to `func`.
**kwargs
**kwargs : dict
Additional keyword arguments to pass to `func`.

Returns
-------
DataFrame
The filtered subset of the original DataFrame.

See Also
--------
SeriesGroupBy.filter : Filter elements from groups base on criterion.

Notes
-----
Each subframe is endowed the attribute 'name' in case you need to know
Expand Down