Skip to content

PandasArray.__setitem__ fails for strings #28118

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
TomAugspurger opened this issue Aug 23, 2019 · 0 comments · Fixed by #28119
Closed

PandasArray.__setitem__ fails for strings #28118

TomAugspurger opened this issue Aug 23, 2019 · 0 comments · Fixed by #28119
Labels
Bug ExtensionArray Extending pandas with custom dtypes or arrays.
Milestone

Comments

@TomAugspurger
Copy link
Contributor

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

In [4]: t[0] = 't'
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-4-7d1c8d6d2e6a> in <module>
----> 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
TomAugspurger added a commit to TomAugspurger/pandas that referenced this issue Aug 23, 2019
@simonjayhawkins simonjayhawkins added ExtensionArray Extending pandas with custom dtypes or arrays. Bug labels Aug 23, 2019
@jreback jreback added this to the 1.0 milestone Sep 10, 2019
TomAugspurger added a commit that referenced this issue Sep 17, 2019
* BUG: Fixed PandasArray.__setitem__ with str

Closes #28118
proost pushed a commit to proost/pandas that referenced this issue Dec 19, 2019
* BUG: Fixed PandasArray.__setitem__ with str

Closes pandas-dev#28118
proost pushed a commit to proost/pandas that referenced this issue Dec 19, 2019
* BUG: Fixed PandasArray.__setitem__ with str

Closes pandas-dev#28118
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug ExtensionArray Extending pandas with custom dtypes or arrays.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants