@@ -740,19 +740,15 @@ cpdef ndarray[object] ensure_string_array(
740
740
return result
741
741
742
742
743
- @ cython.wraparound (False )
744
- @ cython.boundscheck (False )
745
- def clean_index_list (obj: list ):
743
+ def is_all_arraylike (obj: list ) -> bool:
746
744
"""
747
- Utility used in ``pandas.core.indexes.api.ensure_index``.
745
+ Should we treat these as levels of a MultiIndex , as opposed to Index items?
748
746
"""
749
747
cdef:
750
748
Py_ssize_t i , n = len (obj)
751
749
object val
752
750
bint all_arrays = True
753
751
754
- # First check if we have a list of arraylikes, in which case we will
755
- # pass them to MultiIndex.from_arrays
756
752
for i in range(n ):
757
753
val = obj[i]
758
754
if not (isinstance (val, list ) or
@@ -762,31 +758,7 @@ def clean_index_list(obj: list):
762
758
all_arrays = False
763
759
break
764
760
765
- if all_arrays:
766
- return obj, all_arrays
767
-
768
- # don't force numpy coerce with nan's
769
- inferred = infer_dtype(obj, skipna = False )
770
- if inferred in [' string' , ' bytes' , ' mixed' , ' mixed-integer' ]:
771
- return np.asarray(obj, dtype = object ), 0
772
- elif inferred in [' integer' ]:
773
- # we infer an integer but it *could* be a uint64
774
-
775
- arr = np.asarray(obj)
776
- if arr.dtype.kind not in [" i" , " u" ]:
777
- # eg [0, uint64max] gets cast to float64,
778
- # but then we know we have either uint64 or object
779
- if (arr < 0 ).any():
780
- # TODO: similar to maybe_cast_to_integer_array
781
- return np.asarray(obj, dtype = " object" ), 0
782
-
783
- # GH#35481
784
- guess = np.asarray(obj, dtype = " uint64" )
785
- return guess, 0
786
-
787
- return arr, 0
788
-
789
- return np.asarray(obj), 0
761
+ return all_arrays
790
762
791
763
792
764
# ------------------------------------------------------------------------------
0 commit comments