Skip to content

BUG: DataFrame.iloc.setitem with IntegerArray values #38952

Closed
@jbrockmendel

Description

@jbrockmendel
arr = pd.array([4, 5, 6])
df = pd.DataFrame(np.arange(3))

>>> df.iloc[:2] = arr[:2]
ValueError: could not broadcast input array from shape (2) into shape (2,1)

>>> df.iloc[:2] = arr[:2].to_numpy()  # <-- works fine

This bug would not occur with 2D EAs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugExtensionArrayExtending pandas with custom dtypes or arrays.IndexingRelated to indexing on series/frames, not to indexes themselvesNeeds TriageIssue that has not been reviewed by a pandas team member

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions