Skip to content

Commit 60ba975

Browse files
remove aggregate_size block method
1 parent 0b040c0 commit 60ba975

File tree

3 files changed

+4
-33
lines changed

3 files changed

+4
-33
lines changed

bigframes/core/blocks.py

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1347,37 +1347,6 @@ def aggregate_all_and_stack(
13471347
block, id = self.project_expr(reduced, None)
13481348
return block.select_column(id)
13491349

1350-
def aggregate_size(
1351-
self,
1352-
by_column_ids: typing.Sequence[str] = (),
1353-
*,
1354-
dropna: bool = True,
1355-
):
1356-
"""Returns a block object to compute the size(s) of groups."""
1357-
agg_specs = [
1358-
(
1359-
agg_expressions.NullaryAggregation(agg_ops.SizeOp()),
1360-
guid.generate_guid(),
1361-
),
1362-
]
1363-
output_col_ids = [agg_spec[1] for agg_spec in agg_specs]
1364-
result_expr = self.expr.aggregate(agg_specs, by_column_ids, dropna=dropna)
1365-
names: typing.List[Label] = []
1366-
for by_col_id in by_column_ids:
1367-
if by_col_id in self.value_columns:
1368-
names.append(self.col_id_to_label[by_col_id])
1369-
else:
1370-
names.append(self.col_id_to_index_name[by_col_id])
1371-
return (
1372-
Block(
1373-
result_expr,
1374-
index_columns=by_column_ids,
1375-
column_labels=["size"],
1376-
index_labels=names,
1377-
),
1378-
output_col_ids,
1379-
)
1380-
13811350
def select_column(self, id: str) -> Block:
13821351
return self.select_columns([id])
13831352

bigframes/core/groupby/dataframe_group_by.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,8 @@ def __len__(self) -> int:
182182
return len(self.agg([]))
183183

184184
def size(self) -> typing.Union[df.DataFrame, series.Series]:
185-
agg_block, _ = self._block.aggregate_size(
185+
agg_block = self._block.aggregate(
186+
aggregations=[agg_ops.SizeOp().as_expr()],
186187
by_column_ids=self._by_col_ids,
187188
dropna=self._dropna,
188189
)

bigframes/core/groupby/series_group_by.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,8 @@ def var(self, *args, **kwargs) -> series.Series:
189189
return self._aggregate(agg_ops.var_op)
190190

191191
def size(self) -> series.Series:
192-
agg_block, _ = self._block.aggregate_size(
192+
agg_block = self._block.aggregate(
193+
aggregations=[agg_ops.SizeOp().as_expr()],
193194
by_column_ids=self._by_col_ids,
194195
dropna=self._dropna,
195196
)

0 commit comments

Comments
 (0)