|
49 | 49 | is_1d_only_ea_dtype,
|
50 | 50 | is_1d_only_ea_obj,
|
51 | 51 | is_dtype_equal,
|
52 |
| - is_extension_array_dtype, |
53 | 52 | is_interval_dtype,
|
54 | 53 | is_list_like,
|
55 | 54 | is_string_dtype,
|
@@ -911,37 +910,26 @@ def setitem(self, indexer, value):
|
911 | 910 | `indexer` is a direct slice/positional indexer. `value` must
|
912 | 911 | be a compatible shape.
|
913 | 912 | """
|
914 |
| - transpose = self.ndim == 2 |
915 |
| - |
916 |
| - if isinstance(indexer, np.ndarray) and indexer.ndim > self.ndim: |
917 |
| - raise ValueError(f"Cannot set values with ndim > {self.ndim}") |
918 | 913 |
|
919 | 914 | # coerce None values, if appropriate
|
920 | 915 | if value is None:
|
921 | 916 | if self.is_numeric:
|
922 | 917 | value = np.nan
|
923 | 918 |
|
924 | 919 | # coerce if block dtype can store value
|
925 |
| - values = cast(np.ndarray, self.values) |
926 | 920 | if not self._can_hold_element(value):
|
927 | 921 | # current dtype cannot store value, coerce to common dtype
|
928 | 922 | return self.coerce_to_target_dtype(value).setitem(indexer, value)
|
929 | 923 |
|
930 | 924 | # value must be storable at this moment
|
931 |
| - if is_extension_array_dtype(getattr(value, "dtype", None)): |
932 |
| - # We need to be careful not to allow through strings that |
933 |
| - # can be parsed to EADtypes |
934 |
| - arr_value = value |
935 |
| - else: |
936 |
| - arr_value = np.asarray(value) |
937 |
| - |
938 |
| - if transpose: |
| 925 | + values = cast(np.ndarray, self.values) |
| 926 | + if self.ndim == 2: |
939 | 927 | values = values.T
|
940 | 928 |
|
941 | 929 | # length checking
|
942 | 930 | check_setitem_lengths(indexer, value, values)
|
943 | 931 |
|
944 |
| - if is_empty_indexer(indexer, arr_value): |
| 932 | + if is_empty_indexer(indexer): |
945 | 933 | # GH#8669 empty indexers, test_loc_setitem_boolean_mask_allfalse
|
946 | 934 | pass
|
947 | 935 |
|
|
0 commit comments