From 9f90db7072b81cc70f397e9394a24b1ece47488f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dea=20Mar=C3=ADa=20L=C3=A9on?= Date: Thu, 17 Oct 2024 15:23:40 +0200 Subject: [PATCH] combine list+struct --- narwhals/_pandas_like/utils.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/narwhals/_pandas_like/utils.py b/narwhals/_pandas_like/utils.py index 8b3bc5538..20faa0814 100644 --- a/narwhals/_pandas_like/utils.py +++ b/narwhals/_pandas_like/utils.py @@ -280,7 +280,7 @@ def native_to_narwhals_dtype(native_column: Any, dtypes: DTypes) -> DType: return dtypes.Duration(du_time_unit) if dtype == "date32[day][pyarrow]": return dtypes.Date() - if dtype.startswith(("large_list", "list")): + if dtype.startswith(("large_list", "list", "struct")): return arrow_native_to_narwhals_dtype(native_column.dtype.pyarrow_dtype, dtypes) if dtype.startswith("fixed_size_list"): return dtypes.Array( @@ -289,8 +289,6 @@ def native_to_narwhals_dtype(native_column: Any, dtypes: DTypes) -> DType: ), native_column.dtype.pyarrow_dtype.list_size, ) - if dtype.startswith("struct"): - return arrow_native_to_narwhals_dtype(native_column.dtype.pyarrow_dtype, dtypes) if dtype == "object": if ( # pragma: no cover TODO(unassigned): why does this show as uncovered? idx := getattr(native_column, "first_valid_index", lambda: None)()