Skip to content

Commit 4dc0514

Browse files
committed
refactor: Implement CompliantDataFrame.aggregate
#2223 (comment)
1 parent 70cc069 commit 4dc0514

File tree

3 files changed

+1
-11
lines changed

3 files changed

+1
-11
lines changed

narwhals/_arrow/dataframe.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -358,9 +358,6 @@ def simple_select(self, *column_names: str) -> Self:
358358
self._native_frame.select(list(column_names)), validate_column_names=False
359359
)
360360

361-
def aggregate(self: ArrowDataFrame, *exprs: ArrowExpr) -> ArrowDataFrame:
362-
return self.select(*exprs)
363-
364361
def select(self: ArrowDataFrame, *exprs: ArrowExpr) -> ArrowDataFrame:
365362
new_series = self._evaluate_into_exprs(*exprs)
366363
if not new_series:

narwhals/_compliant/dataframe.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,12 @@ def simple_select(self, *column_names: str) -> Self:
4646
"""`select` where all args are column names."""
4747
...
4848

49-
# NOTE: Can we remove this now?
50-
# `DaskLazyFrame` is the only one not the same as `select`
5149
def aggregate(self, *exprs: Any) -> Self: # pragma: no cover
5250
"""`select` where all args are aggregations or literals.
5351
5452
(so, no broadcasting is necessary).
5553
"""
56-
...
54+
return self.select(*exprs)
5755

5856
@property
5957
def columns(self) -> Sequence[str]: ...

narwhals/_pandas_like/dataframe.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -396,11 +396,6 @@ def simple_select(self: Self, *column_names: str) -> Self:
396396
validate_column_names=False,
397397
)
398398

399-
def aggregate(
400-
self: PandasLikeDataFrame, *exprs: PandasLikeExpr
401-
) -> PandasLikeDataFrame:
402-
return self.select(*exprs)
403-
404399
def select(self: PandasLikeDataFrame, *exprs: PandasLikeExpr) -> PandasLikeDataFrame:
405400
new_series = self._evaluate_into_exprs(*exprs)
406401
if not new_series:

0 commit comments

Comments
 (0)