Skip to content

BUG: ArrowStringArray.__setitem__ breaks views #45419

Open
@jbrockmendel

Description

@jbrockmendel
arr = pd.array(['foo', 'bar'], dtype='string[pyarrow]')
arr2 = arr[:]

arr2[0] = 'baz'

>>> arr
<ArrowStringArray>
['foo', 'bar']
Length: 2, dtype: string

Looks like in ArrowStringArray.__setitem__ we set self._data = ...

I expect this is a consquence of Arrow arrays (just the string arrays?) being immutable and there's likely not much we can do about it.

This seems likely to cause a long tail of headaches, might be better to raise for immutable arrays (like we do with SparseArray)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Arrowpyarrow functionalityBugExtensionArrayExtending pandas with custom dtypes or arrays.IndexingRelated to indexing on series/frames, not to indexes themselves

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions