diff --git a/ci/code_checks.sh b/ci/code_checks.sh index 7ed5103b3b796..6ceba1dd6da89 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -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" \ @@ -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" \ diff --git a/pandas/core/groupby/generic.py b/pandas/core/groupby/generic.py index c112d9b6a4b54..230f61bab96df 100644 --- a/pandas/core/groupby/generic.py +++ b/pandas/core/groupby/generic.py @@ -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 @@ -1943,9 +1951,9 @@ 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 @@ -1953,6 +1961,10 @@ def filter(self, func, dropna: bool = True, *args, **kwargs) -> DataFrame: 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