diff --git a/pandas/core/internals/base.py b/pandas/core/internals/base.py index 75ae0f62681aa..b365bf9e08b0e 100644 --- a/pandas/core/internals/base.py +++ b/pandas/core/internals/base.py @@ -187,7 +187,7 @@ def setitem_inplace(self, indexer, value) -> None: # dt64/td64, which do their own validation. value = np_can_hold_element(arr.dtype, value) - self.array[indexer] = value + arr[indexer] = value def grouped_reduce(self, func, ignore_failures: bool = False): """ diff --git a/pandas/core/series.py b/pandas/core/series.py index ac892573ae08b..53ff67220a96d 100644 --- a/pandas/core/series.py +++ b/pandas/core/series.py @@ -62,7 +62,6 @@ ) from pandas.core.dtypes.cast import ( - can_hold_element, convert_dtypes, maybe_box_native, maybe_cast_pointwise_result, @@ -1145,12 +1144,6 @@ def __setitem__(self, key, value) -> None: def _set_with_engine(self, key, value) -> None: loc = self.index.get_loc(key) - dtype = self.dtype - if isinstance(dtype, np.dtype) and dtype.kind not in ["m", "M"]: - # otherwise we have EA values, and this check will be done - # via setitem_inplace - if not can_hold_element(self._values, value): - raise ValueError # this is equivalent to self._values[key] = value self._mgr.setitem_inplace(loc, value)