Skip to content

Commit

Permalink
Update check for array types in is_list_dtype (#253)
Browse files Browse the repository at this point in the history
To handle different versions of pandas by removing the use of pandas is_list_like
  • Loading branch information
oliverholworthy authored Mar 21, 2023
1 parent df9f026 commit 8df89bc
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions merlin/core/dispatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,10 +343,8 @@ def is_list_dtype(ser):
return pd.api.types.is_list_like(ser.values[0])
elif cudf and isinstance(ser, (cudf.Series, cudf.ListDtype)):
return cudf_is_list_dtype(ser)
elif cudf and isinstance(ser, cp.ndarray):
return pd.api.types.is_list_like(ser[0])
elif isinstance(ser, np.ndarray):
return pd.api.types.is_list_like(ser[0])
elif isinstance(ser, np.ndarray) or (cp and isinstance(ser, cp.ndarray)):
return len(ser.shape) > 1
return pd.api.types.is_list_like(ser)


Expand Down

0 comments on commit 8df89bc

Please sign in to comment.