@@ -566,14 +566,6 @@ def sanitize_array(
566566 # extract ndarray or ExtensionArray, ensure we have no NumpyExtensionArray
567567 data = extract_array (data , extract_numpy = True , extract_range = True )
568568
569- # GH#61026: when 2D input is allowed (e.g. DataFrame column assignment),
570- # treat a (n, 1) numpy array as a 1D array of length n so downstream code
571- # (including pyarrow-backed StringArray) always sees 1D.
572- if allow_2d and isinstance (data , np .ndarray ) and data .ndim == 2 :
573- rows , cols = data .shape
574- if cols == 1 :
575- data = data [:, 0 ]
576-
577569 if isinstance (data , np .ndarray ) and data .ndim == 0 :
578570 if dtype is None :
579571 dtype = data .dtype
@@ -619,24 +611,6 @@ def sanitize_array(
619611 data = data .A
620612
621613 if dtype is None :
622- # GH#61026: special-case 2D+ object ndarrays when dtype is None.
623- if allow_2d and data .dtype == object and data .ndim > 1 :
624- if data .ndim == 2 and data .shape [1 ] == 1 :
625- # allow assigning a (n, 1) object array to a single column.
626- data = data [:, 0 ]
627- elif data .ndim == 2 :
628- # more than 1 column, not allowed.
629- raise ValueError (
630- "Setting a DataFrame column with a 2D object array "
631- f"requires shape (n, 1); got shape { data .shape } ."
632- )
633- else :
634- # ndim >= 3
635- raise ValueError (
636- f"Setting a DataFrame column with ndim { data .ndim } "
637- "object array is not supported."
638- )
639-
640614 subarr = data
641615 if data .dtype == object and infer_object :
642616 subarr = lib .maybe_convert_objects (
0 commit comments