Skip to content

Commit 333bc67

Browse files
committed
refactor: remove uncovered Implementation checl
Resolves #2196 (comment)
1 parent 82be657 commit 333bc67

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

narwhals/_pandas_like/series.py

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -196,19 +196,13 @@ def _from_iterable(
196196
@classmethod
197197
def from_numpy(cls, data: Into1DArray, /, *, context: _FullContext) -> Self:
198198
implementation = context._implementation
199-
if implementation.is_pandas_like():
200-
arr = data if is_numpy_array_1d(data) else [data]
201-
return cls(
202-
implementation.to_native_namespace().Series(arr, name=""),
203-
implementation=implementation,
204-
backend_version=context._backend_version,
205-
version=context._version,
206-
)
207-
else: # pragma: no cover
208-
from narwhals._pandas_like.utils import PANDAS_LIKE_IMPLEMENTATION
209-
210-
msg = f"Expected pandas-like implementation ({PANDAS_LIKE_IMPLEMENTATION}), found {implementation}"
211-
raise TypeError(msg)
199+
arr = data if is_numpy_array_1d(data) else [data]
200+
return cls(
201+
implementation.to_native_namespace().Series(arr, name=""),
202+
implementation=implementation,
203+
backend_version=context._backend_version,
204+
version=context._version,
205+
)
212206

213207
def __len__(self: Self) -> int:
214208
return len(self.native)

0 commit comments

Comments
 (0)