Skip to content

fix: fix grouping series on multiple other series #455

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 3 commits into from
Mar 19, 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: 1 addition & 1 deletion bigframes/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -1195,7 +1195,7 @@ def _groupby_values(
get_column_right,
) = block.join(key._block, how="inner" if dropna else "left")

value_col = get_column_left[self._value_column]
value_col = get_column_left[value_col]
grouping_cols = [
*[get_column_left[value] for value in grouping_cols],
get_column_right[key._value_column],
Expand Down
10 changes: 8 additions & 2 deletions tests/system/small/test_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -1313,9 +1313,15 @@ def test_any(scalars_dfs):
def test_groupby_sum(scalars_dfs):
scalars_df, scalars_pandas_df = scalars_dfs
col_name = "int64_too"
bf_series = scalars_df[col_name].groupby(scalars_df["string_col"]).sum()
bf_series = (
scalars_df[col_name]
.groupby([scalars_df["bool_col"], ~scalars_df["bool_col"]])
.sum()
)
pd_series = (
scalars_pandas_df[col_name].groupby(scalars_pandas_df["string_col"]).sum()
scalars_pandas_df[col_name]
.groupby([scalars_pandas_df["bool_col"], ~scalars_pandas_df["bool_col"]])
.sum()
)
# TODO(swast): Update groupby to use index based on group by key(s).
bf_result = bf_series.to_pandas()
Expand Down