Skip to content

Commit

Permalink
Simplify return function in _pandas_like.utils.py (#1204)
Browse files Browse the repository at this point in the history
* list change

* combine list+struct

* forgot fixed_size_list
  • Loading branch information
DeaMariaLeon authored Oct 17, 2024
1 parent 5ef1803 commit 696dbff
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions narwhals/_pandas_like/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,20 +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")):
return dtypes.List(
arrow_native_to_narwhals_dtype(
native_column.dtype.pyarrow_dtype.value_type, dtypes
)
)
if dtype.startswith("fixed_size_list"):
return dtypes.Array(
arrow_native_to_narwhals_dtype(
native_column.dtype.pyarrow_dtype.value_type, dtypes
),
native_column.dtype.pyarrow_dtype.list_size,
)
if dtype.startswith("struct"):
if dtype.startswith(("large_list", "list", "struct", "fixed_size_list")):
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?
Expand Down

0 comments on commit 696dbff

Please sign in to comment.