1818from narwhals ._compliant .typing import EagerSeriesT
1919from narwhals ._compliant .typing import NativeFrameT_co
2020from narwhals ._expression_parsing import evaluate_output_names_and_aliases
21+ from narwhals ._translate import NumpyConvertible
2122from narwhals .utils import Version
2223from narwhals .utils import _StoresNative
2324from narwhals .utils import deprecated
3435
3536 from narwhals ._compliant .group_by import CompliantGroupBy
3637 from narwhals .dtypes import DType
38+ from narwhals .schema import Schema
3739 from narwhals .typing import SizeUnit
3840 from narwhals .typing import _2DArray
3941 from narwhals .utils import Implementation
42+ from narwhals .utils import _FullContext
4043
4144 Incomplete : TypeAlias = Any
4245
4649
4750
4851class CompliantDataFrame (
52+ NumpyConvertible ["_2DArray" ],
4953 _StoresNative [NativeFrameT_co ],
5054 Sized ,
5155 Protocol [CompliantSeriesT , CompliantExprT_contra , NativeFrameT_co ],
@@ -57,6 +61,15 @@ class CompliantDataFrame(
5761
5862 def __narwhals_dataframe__ (self ) -> Self : ...
5963 def __narwhals_namespace__ (self ) -> Any : ...
64+ @classmethod
65+ def from_numpy (
66+ cls ,
67+ data : _2DArray ,
68+ / ,
69+ * ,
70+ context : _FullContext ,
71+ schema : Mapping [str , DType ] | Schema | Sequence [str ] | None ,
72+ ) -> Self : ...
6073 def __array__ (self , dtype : Any , * , copy : bool | None ) -> _2DArray : ...
6174 def __getitem__ (self , item : Any ) -> CompliantSeriesT | Self : ...
6275 def simple_select (self , * column_names : str ) -> Self :
@@ -286,7 +299,8 @@ def _evaluate_expr(self, expr: EagerExprT_contra, /) -> EagerSeriesT:
286299 return result [0 ]
287300
288301 def _evaluate_into_exprs (self , * exprs : EagerExprT_contra ) -> Sequence [EagerSeriesT ]:
289- return list (chain .from_iterable (self ._evaluate_into_expr (expr ) for expr in exprs ))
302+ # NOTE: Ignore is to avoid an intermittent false positive
303+ return list (chain .from_iterable (self ._evaluate_into_expr (expr ) for expr in exprs )) # pyright: ignore[reportArgumentType]
290304
291305 def _evaluate_into_expr (self , expr : EagerExprT_contra , / ) -> Sequence [EagerSeriesT ]:
292306 """Return list of raw columns.
0 commit comments