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: update GroupBy docstrings #1103

Merged
merged 3 commits into from
Oct 30, 2024
Merged
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
86 changes: 56 additions & 30 deletions third_party/bigframes_vendored/pandas/core/groupby/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ def any(self):
[2 rows x 2 columns]

Returns:
Series or DataFrame: DataFrame or Series of boolean values,
bigframes.pandas.DataFrame or bigframes.pandas.Series:
DataFrame or Series of boolean values,
where a value is True if any element is True within its
respective group; otherwise False.
"""
Expand Down Expand Up @@ -87,7 +88,8 @@ def all(self):
[2 rows x 2 columns]

Returns:
Series or DataFrame: DataFrame or Series of boolean values,
bigframes.pandas.DataFrame or bigframes.pandas.Series:
DataFrame or Series of boolean values,
where a value is True if all elements are True within its
respective group; otherwise False.
"""
Expand Down Expand Up @@ -126,7 +128,8 @@ def count(self):
[2 rows x 2 columns]

Returns:
Series or DataFrame: Count of values within each group.
bigframes.pandas.DataFrame or bigframes.pandas.Series:
Count of values within each group.
"""
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)

Expand Down Expand Up @@ -181,7 +184,8 @@ def mean(
Include only float, int, boolean columns.

Returns:
pandas.Series or pandas.DataFrame: Mean of groups.
bigframes.pandas.DataFrame or bigframes.pandas.Series:
Mean of groups.
"""
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)

Expand Down Expand Up @@ -228,7 +232,8 @@ def median(
Calculate the exact median instead of an approximation.

Returns:
pandas.Series or pandas.DataFrame: Median of groups.
bigframes.pandas.DataFrame or bigframes.pandas.Series:
Median of groups.
"""
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)

Expand Down Expand Up @@ -259,7 +264,8 @@ def quantile(self, q=0.5, *, numeric_only: bool = False):
Include only `float`, `int` or `boolean` data.

Returns:
Series or DataFrame: Return type determined by caller of GroupBy object.
bigframes.pandas.DataFrame or bigframes.pandas.Series:
Return type determined by caller of GroupBy object.
"""
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)

Expand Down Expand Up @@ -305,7 +311,8 @@ def std(
Include only `float`, `int` or `boolean` data.

Returns:
Series or DataFrame: Standard deviation of values within each group.
bigframes.pandas.DataFrame or bigframes.pandas.Series:
Standard deviation of values within each group.
"""
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)

Expand Down Expand Up @@ -351,7 +358,7 @@ def var(
Include only `float`, `int` or `boolean` data.

Returns:
Series or DataFrame
bigframes.pandas.DataFrame or bigframes.pandas.Series:
Variance of values within each group.
"""
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)
Expand Down Expand Up @@ -388,7 +395,7 @@ def skew(
Include only `float`, `int` or `boolean` data.

Returns:
Series or DataFrame
bigframes.pandas.DataFrame or bigframes.pandas.Series:
Variance of values within each group.
"""
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)
Expand Down Expand Up @@ -421,7 +428,7 @@ def kurt(
Include only `float`, `int` or `boolean` data.

Returns:
Series or DataFrame
bigframes.pandas.DataFrame or bigframes.pandas.Series:
Variance of values within each group.
"""
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)
Expand Down Expand Up @@ -454,7 +461,7 @@ def kurtosis(
Include only `float`, `int` or `boolean` data.

Returns:
Series or DataFrame
bigframes.pandas.DataFrame or bigframes.pandas.Series:
Variance of values within each group.
"""
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)
Expand Down Expand Up @@ -502,7 +509,8 @@ def sum(
than ``min_count`` and non-NA values are present, the result will be NA.

Returns:
Series or DataFrame: Computed sum of values within each group.
bigframes.pandas.DataFrame or bigframes.pandas.Series:
Computed sum of values within each group.
"""
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)

Expand Down Expand Up @@ -534,7 +542,8 @@ def prod(self, numeric_only: bool = False, min_count: int = 0):
than ``min_count`` and non-NA values are present, the result will be NA.

Returns:
Series or DataFrame: Computed prod of values within each group.
bigframes.pandas.DataFrame or bigframes.pandas.Series:
Computed prod of values within each group.
"""
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)

Expand Down Expand Up @@ -582,7 +591,8 @@ def min(
than ``min_count`` and non-NA values are present, the result will be NA.

Returns:
Series or DataFrame: Computed min of values within each group.
bigframes.pandas.DataFrame or bigframes.pandas.Series:
Computed min of values within each group.
"""
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)

Expand Down Expand Up @@ -629,7 +639,8 @@ def max(
than ``min_count`` and non-NA values are present, the result will be NA.

Returns:
Series or DataFrame: Computed max of values within each group.
bigframes.pandas.DataFrame or bigframes.pandas.Series:
Computed max of values within each group.
"""
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)

Expand Down Expand Up @@ -667,7 +678,8 @@ def cumcount(self, ascending: bool = True):
If False, number in reverse, from length of group - 1 to 0.

Returns:
Series: Sequence number of each element within each group.
bigframes.pandas.Series:
Sequence number of each element within each group.
"""
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)

Expand Down Expand Up @@ -705,7 +717,8 @@ def cumprod(self, *args, **kwargs):
[3 rows x 2 columns]

Returns:
Series or DataFrame: Cumulative product for each group.
bigframes.pandas.DataFrame or bigframes.pandas.Series:
Cumulative product for each group.
"""
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)

Expand Down Expand Up @@ -743,7 +756,8 @@ def cumsum(self, *args, **kwargs):
[3 rows x 2 columns]

Returns:
Series or DataFrame: Cumulative sum for each group.
bigframes.pandas.DataFrame or bigframes.pandas.Series:
Cumulative sum for each group.
"""
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)

Expand Down Expand Up @@ -781,7 +795,8 @@ def cummin(self, *args, numeric_only: bool = False, **kwargs):
[3 rows x 2 columns]

Returns:
Series or DataFrame: Cumulative min for each group.
bigframes.pandas.DataFrame or bigframes.pandas.Series:
Cumulative min for each group.
"""
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)

Expand Down Expand Up @@ -819,7 +834,8 @@ def cummax(self, *args, numeric_only: bool = False, **kwargs):
[3 rows x 2 columns]

Returns:
Series or DataFrame: Cumulative max for each group.
bigframes.pandas.DataFrame or bigframes.pandas.Series:
Cumulative max for each group.
"""
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)

Expand Down Expand Up @@ -866,7 +882,8 @@ def diff(self):
[7 rows x 2 columns]

Returns:
Series or DataFrame: First differences.
bigframes.pandas.DataFrame or bigframes.pandas.Series:
First differences.
"""
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)

Expand Down Expand Up @@ -910,7 +927,8 @@ def shift(self, periods: int = 1):
Number of periods to shift.

Returns:
Series or DataFrame: Object shifted within each group.
bigframes.pandas.DataFrame or bigframes.pandas.Series:
Object shifted within each group.
"""
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)

Expand Down Expand Up @@ -947,7 +965,8 @@ def rolling(self, *args, **kwargs):
to the size of the window.

Returns:
Series or DataFrame: Return a new grouper with our rolling appended.
bigframes.pandas.DataFrame or bigframes.pandas.Series:
Return a new grouper with our rolling appended.
"""
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)

Expand All @@ -973,7 +992,8 @@ def expanding(self, *args, **kwargs):
dtype: Int64

Returns:
Series or DataFrame: An expanding grouper, providing expanding functionality per group.
bigframes.pandas.DataFrame or bigframes.pandas.Series:
An expanding grouper, providing expanding functionality per group.
"""
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)

Expand Down Expand Up @@ -1007,7 +1027,8 @@ def agg(self, func):
- list of function names, e.g. ``['sum', 'mean']``

Returns:
Series or DataFrame
bigframes.pandas.Series:
A BigQuery Series.
"""
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)

Expand Down Expand Up @@ -1039,7 +1060,8 @@ def aggregate(self, func):
- list of function names, e.g. ``['sum', 'mean']``

Returns:
Series or DataFrame
bigframes.pandas.Series:
A BigQuery Series.
"""
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)

Expand All @@ -1061,7 +1083,8 @@ def nunique(self):
dtype: Int64

Returns:
Series: Number of unique values within each group.
bigframes.pandas.Series:
Number of unique values within each group.
"""
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)

Expand Down Expand Up @@ -1122,7 +1145,8 @@ def agg(self, func, **kwargs):
aggregations via Named Aggregation. See ``func`` entry.

Returns:
DataFrame
bigframes.pandas.DataFrame:
A BigQuery DataFrame.
"""
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)

Expand Down Expand Up @@ -1181,7 +1205,8 @@ def aggregate(self, func, **kwargs):
aggregations via Named Aggregation. See ``func`` entry.

Returns:
DataFrame
bigframes.pandas.DataFrame:
A BigQuery DataFrame.
"""
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)

Expand Down Expand Up @@ -1209,6 +1234,7 @@ def nunique(self):
[3 rows x 2 columns]

Returns:
DataFrame
bigframes.pandas.DataFrame:
Number of unique values within a BigQuery DataFrame.
"""
raise NotImplementedError(constants.ABSTRACT_METHOD_ERROR_MESSAGE)