File tree Expand file tree Collapse file tree 3 files changed +42
-5
lines changed
Expand file tree Collapse file tree 3 files changed +42
-5
lines changed Original file line number Diff line number Diff line change 1313from narwhals .compliant import CompliantExpr
1414
1515from narwhals_daft .expr_dt import ExprDateTimeNamesSpace
16+ from narwhals_daft .expr_list import ExprListNamespace
1617from narwhals_daft .expr_name import ExprNameNamespace
1718from narwhals_daft .expr_str import ExprStringNamespace
1819from narwhals_daft .utils import evaluate_literal , extend_bool , narwhals_to_native_dtype
@@ -855,6 +856,10 @@ def str(self) -> ExprStringNamespace:
855856 def dt (self ) -> ExprDateTimeNamesSpace :
856857 return ExprDateTimeNamesSpace (self )
857858
859+ @property
860+ def list (self ) -> ExprListNamespace :
861+ return ExprListNamespace (self )
862+
858863 drop_nulls = not_implemented ()
859864 fill_nan = not_implemented ()
860865 filter = not_implemented ()
@@ -871,6 +876,5 @@ def dt(self) -> ExprDateTimeNamesSpace:
871876
872877 # namespaces
873878 cat = not_implemented () # pyright: ignore[reportAssignmentType]
874- list = not_implemented () # pyright: ignore[reportAssignmentType]
875879 struct = not_implemented () # pyright: ignore[reportAssignmentType]
876880 any_value = not_implemented ()
Original file line number Diff line number Diff line change 1+ from __future__ import annotations
2+
3+ from typing import TYPE_CHECKING
4+
5+ import daft .functions as F
6+ from narwhals ._compliant .any_namespace import ListNamespace
7+ from narwhals ._utils import not_implemented
8+
9+ if TYPE_CHECKING :
10+ from narwhals_daft .expr import DaftExpr
11+
12+
13+ class ExprListNamespace (ListNamespace ["DaftExpr" ]):
14+ def __init__ (self , expr : DaftExpr , / ) -> None :
15+ self ._compliant = expr
16+
17+ @property
18+ def compliant (self ) -> DaftExpr :
19+ return self ._compliant
20+
21+ def len (self ) -> DaftExpr :
22+ return self .compliant ._with_elementwise (lambda expr : F .list_count (expr , "all" ))
23+
24+ def min (self ) -> DaftExpr :
25+ return self .compliant ._with_elementwise (lambda expr : F .list_min (expr ))
26+
27+ def max (self ) -> DaftExpr :
28+ return self .compliant ._with_elementwise (lambda expr : F .list_max (expr ))
29+
30+ def mean (self ) -> DaftExpr :
31+ return self .compliant ._with_elementwise (lambda expr : F .list_mean (expr ))
32+
33+ unique = not_implemented ()
34+ contains = not_implemented ()
35+ get = not_implemented ()
36+ median = not_implemented ()
37+ sum = not_implemented ()
Original file line number Diff line number Diff line change 5555 "test_joinasof_time" ,
5656 "test_kurtosis_expr" ,
5757 "test_left_to_right_broadcasting" ,
58- "test_len_expr" ,
5958 "test_mapping_key_not_in_expr" ,
60- "test_max_expr" ,
61- "test_mean_expr" ,
6259 "test_median_expr" ,
6360 "test_median_expr_raises_on_str" ,
64- "test_min_expr" ,
6561 "test_missing_columns" ,
6662 "test_mode_expr_keep_all_lazy" ,
6763 "test_mode_expr_keep_any" ,
You can’t perform that action at this time.
0 commit comments