Skip to content

Commit a066213

Browse files
committed
feat: add EagerExpr.from_column_(names|indices)
They can use the same signature by not passing in `Implementation` and handling that internally
1 parent 5d766c2 commit a066213

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

narwhals/_compliant/expr.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,22 @@ def _from_series(cls, series: EagerSeriesT, *, context: _FullContext) -> Self:
307307
version=context._version,
308308
)
309309

310+
@classmethod
311+
def from_column_names(
312+
cls,
313+
evaluate_column_names: Callable[[EagerDataFrameT], Sequence[str]],
314+
/,
315+
*,
316+
function_name: str,
317+
context: _FullContext,
318+
) -> Self: ...
319+
@classmethod
320+
def from_column_indices(
321+
cls,
322+
*column_indices: int,
323+
context: _FullContext,
324+
) -> Self: ...
325+
310326
# https://github.com/narwhals-dev/narwhals/blob/35cef0b1e2c892fb24aa730902b08b6994008c18/narwhals/_protocols.py#L135
311327
def _reuse_series_implementation(
312328
self: EagerExpr[EagerDataFrameT, EagerSeriesT],

0 commit comments

Comments
 (0)