Skip to content

Commit

Permalink
cheaper check, dont rely on pl.col("")
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoGorelli committed May 7, 2024
1 parent 9b9dcfb commit a96bf7d
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions narwhals/dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,7 @@ def _extract_native(self, arg: Any) -> Any:
return arg._series
if isinstance(arg, Expr):
return arg._call(self.__narwhals_namespace__())
if (pl := get_polars()) is not None and isinstance(
arg, (pl.Series, pl.DataFrame, pl.LazyFrame, type(pl.col("")))
):
if get_polars() is not None and "polars" in str(type(arg)):
msg = (
f"Expected Narwhals object, got: {type(arg)}.\n\n"
"Perhaps you:\n"
Expand Down

0 comments on commit a96bf7d

Please sign in to comment.