Skip to content

Commit fbea9df

Browse files
fix: fix grouping series on multiple other series (#455)
1 parent 4559fb0 commit fbea9df

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

bigframes/series.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1195,7 +1195,7 @@ def _groupby_values(
11951195
get_column_right,
11961196
) = block.join(key._block, how="inner" if dropna else "left")
11971197

1198-
value_col = get_column_left[self._value_column]
1198+
value_col = get_column_left[value_col]
11991199
grouping_cols = [
12001200
*[get_column_left[value] for value in grouping_cols],
12011201
get_column_right[key._value_column],

tests/system/small/test_series.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -1313,9 +1313,15 @@ def test_any(scalars_dfs):
13131313
def test_groupby_sum(scalars_dfs):
13141314
scalars_df, scalars_pandas_df = scalars_dfs
13151315
col_name = "int64_too"
1316-
bf_series = scalars_df[col_name].groupby(scalars_df["string_col"]).sum()
1316+
bf_series = (
1317+
scalars_df[col_name]
1318+
.groupby([scalars_df["bool_col"], ~scalars_df["bool_col"]])
1319+
.sum()
1320+
)
13171321
pd_series = (
1318-
scalars_pandas_df[col_name].groupby(scalars_pandas_df["string_col"]).sum()
1322+
scalars_pandas_df[col_name]
1323+
.groupby([scalars_pandas_df["bool_col"], ~scalars_pandas_df["bool_col"]])
1324+
.sum()
13191325
)
13201326
# TODO(swast): Update groupby to use index based on group by key(s).
13211327
bf_result = bf_series.to_pandas()

0 commit comments

Comments
 (0)