Skip to content

Commit 5e4b5b7

Browse files
kkleinFBruzzesi
andauthored
Update metalearners/_narwhals_utils.py
Co-authored-by: Francesco Bruzzesi <[email protected]>
1 parent 3ad4f5b commit 5e4b5b7

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

metalearners/_narwhals_utils.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,7 @@ def vector_to_nw(x: Vector, native_namespace: ModuleType | None = None) -> nw.Se
5858

5959

6060
def infer_native_namespace(df_nw: nw.DataFrame) -> ModuleType:
61-
if df_nw.implementation.name == "PANDAS":
62-
return pd
63-
if df_nw.implementation.name == "POLARS":
64-
return pl
65-
raise TypeError("Couldn't infer native_namespace of matrix.")
61+
return df_nw.implementation.to_native_namespace()
6662

6763

6864
def stringify_column_names(df_nw: nw.DataFrame) -> nw.DataFrame:

0 commit comments

Comments
 (0)