Skip to content

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

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
jbrockmendel opened this issue Jan 4, 2021 · 0 comments · Fixed by #39040
Closed

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

jbrockmendel opened this issue Jan 4, 2021 · 0 comments · Fixed by #39040
Labels
Bug ExtensionArray Extending pandas with custom dtypes or arrays. Indexing Related to indexing on series/frames, not to indexes themselves Needs Triage Issue that has not been reviewed by a pandas team member
Milestone

Comments

@jbrockmendel
Copy link
Member

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.

@jbrockmendel jbrockmendel added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Jan 4, 2021
@jreback jreback added this to the 1.3 milestone Jan 8, 2021
@jreback jreback added ExtensionArray Extending pandas with custom dtypes or arrays. Indexing Related to indexing on series/frames, not to indexes themselves labels Jan 9, 2021
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. Indexing Related to indexing on series/frames, not to indexes themselves Needs Triage Issue that has not been reviewed by a pandas team member
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants