99from anndata .compat import CSArray , CSMatrix
1010
1111from .._warnings import ImplicitModificationWarning
12- from ..types import DataFrameLike
1312from ..utils import (
1413 ensure_df_homogeneous ,
1514 get_union_members ,
@@ -37,7 +36,7 @@ def coerce_array(
3736 return value
3837 # If value is one of the allowed types, return it
3938 array_data_structure_types = get_union_members (_ArrayDataStructureTypes )
40- if isinstance (value , ( * array_data_structure_types , DataFrameLike ) ):
39+ if isinstance (value , array_data_structure_types ):
4140 if isinstance (value , np .matrix ):
4241 msg = f"{ name } should not be a np.matrix, use np.ndarray instead."
4342 warn (msg , ImplicitModificationWarning )
@@ -57,15 +56,6 @@ def coerce_array(
5756 if allow_df :
5857 raise_value_error_if_multiindex_columns (value , name )
5958 return value if allow_df else ensure_df_homogeneous (value , name )
60- # Handle other DataFrameLike objects (not pd.DataFrame)
61- if isinstance (value , DataFrameLike ):
62- if allow_df :
63- return value
64- # For non-DataFrames, we can't use ensure_df_homogeneous
65- # so we convert to array via iloc
66- msg = f"DataFrameLike object used for { name } will be converted to array."
67- warn (msg , ImplicitModificationWarning )
68- return np .array (value .iloc [:, :])
6959 # if value is an array-like object, try to convert it
7060 e = None
7161 if allow_array_like :
0 commit comments