55from typing import Iterable
66from typing import Iterator
77from typing import Literal
8+ from typing import Mapping
89from typing import Sequence
910from typing import cast
1011from typing import overload
3233from narwhals .utils import Implementation
3334from narwhals .utils import generate_temporary_column_name
3435from narwhals .utils import import_dtypes_module
36+ from narwhals .utils import not_implemented
3537from narwhals .utils import validate_backend_version
3638
3739if TYPE_CHECKING :
@@ -139,12 +141,8 @@ def _from_native_series(
139141 )
140142
141143 @classmethod
142- def _from_iterable (
143- cls : type [Self ],
144- data : Iterable [Any ],
145- name : str ,
146- * ,
147- context : _FullContext ,
144+ def from_iterable (
145+ cls , data : Iterable [Any ], * , context : _FullContext , name : str = ""
148146 ) -> Self :
149147 return cls (
150148 chunked_array ([data ]),
@@ -160,8 +158,8 @@ def _from_scalar(self, value: Any) -> Self:
160158
161159 @classmethod
162160 def from_numpy (cls , data : Into1DArray , / , * , context : _FullContext ) -> Self :
163- return cls ._from_iterable (
164- data if is_numpy_array_1d (data ) else [data ], name = "" , context = context
161+ return cls .from_iterable (
162+ data if is_numpy_array_1d (data ) else [data ], context = context
165163 )
166164
167165 def __narwhals_namespace__ (self : Self ) -> ArrowNamespace :
@@ -171,9 +169,6 @@ def __narwhals_namespace__(self: Self) -> ArrowNamespace:
171169 backend_version = self ._backend_version , version = self ._version
172170 )
173171
174- def __len__ (self : Self ) -> int :
175- return len (self .native )
176-
177172 def __eq__ (self : Self , other : object ) -> Self : # type: ignore[override]
178173 ser , other = extract_native (self , other )
179174 return self ._from_native_series (pc .equal (ser , other )) # type: ignore[arg-type]
@@ -391,9 +386,6 @@ def __native_namespace__(self: Self) -> ModuleType:
391386 def name (self : Self ) -> str :
392387 return self ._name
393388
394- def __narwhals_series__ (self : Self ) -> Self :
395- return self
396-
397389 @overload
398390 def __getitem__ (self : Self , idx : int ) -> Any : ...
399391
@@ -569,7 +561,7 @@ def arg_true(self: Self) -> Self:
569561 import numpy as np # ignore-banned-import
570562
571563 res = np .flatnonzero (self .native )
572- return self ._from_iterable (res , name = self .name , context = self )
564+ return self .from_iterable (res , name = self .name , context = self )
573565
574566 def item (self : Self , index : int | None = None ) -> Any :
575567 if index is None :
@@ -753,7 +745,11 @@ def unique(self: Self, *, maintain_order: bool) -> Self:
753745 return self ._from_native_series (self .native .unique ())
754746
755747 def replace_strict (
756- self : Self , old : Sequence [Any ], new : Sequence [Any ], * , return_dtype : DType | None
748+ self : Self ,
749+ old : Sequence [Any ] | Mapping [Any , Any ],
750+ new : Sequence [Any ],
751+ * ,
752+ return_dtype : DType | type [DType ] | None ,
757753 ) -> Self :
758754 # https://stackoverflow.com/a/79111029/4451315
759755 idxs = pc .index_in (self .native , pa .array (old ))
@@ -1217,3 +1213,5 @@ def list(self: Self) -> ArrowSeriesListNamespace:
12171213 @property
12181214 def struct (self : Self ) -> ArrowSeriesStructNamespace :
12191215 return ArrowSeriesStructNamespace (self )
1216+
1217+ ewm_mean = not_implemented ()
0 commit comments