PandasArray.setitem fails for strings · Issue #28118 · pandas-dev/pandas (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

@TomAugspurger

Description

@TomAugspurger

In [3]: t = pd.array(['a', 'b', 'c'])

In [4]: t[0] = 't'

TypeError Traceback (most recent call last) in ----> 1 t[0] = 't'

~/sandbox/pandas/pandas/core/arrays/numpy_.py in setitem(self, key, value) 237 238 values = self._ndarray --> 239 t = np.result_type(value, values) 240 if t != self._ndarray.dtype: 241 values = values.astype(t, casting="safe")

<__array_function__ internals> in result_type(*args, **kwargs)

TypeError: data type "t" not understood