Skip to content
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

BUG: DataFrame.where with EA other #38729

Closed
jbrockmendel opened this issue Dec 27, 2020 · 0 comments · Fixed by #38742
Closed

BUG: DataFrame.where with EA other #38729

jbrockmendel opened this issue Dec 27, 2020 · 0 comments · Fixed by #38742
Labels
Bug ExtensionArray Extending pandas with custom dtypes or arrays. Indexing Related to indexing on series/frames, not to indexes themselves
Milestone

Comments

@jbrockmendel
Copy link
Member

df = pd.DataFrame({"A": [1, 2, 3], "B": [4, 5, 6]})
arr = pd.array([7, pd.NA, 9])
mask = np.ones(df.shape, dtype=bool)

>>> result = df.where(mask, arr)
AttributeError: 'IntegerArray' object has no attribute 'reshape'

we can kludge around this by using np.reshape(arr, shape) instead of arr.reshape(shape), but that'll cast to object, which is not great.

Non-kludge solution: 2D EAs

@jbrockmendel jbrockmendel added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Dec 27, 2020
@jbrockmendel jbrockmendel mentioned this issue Dec 28, 2020
5 tasks
@jreback jreback added this to the 1.3 milestone Dec 29, 2020
@jreback jreback added ExtensionArray Extending pandas with custom dtypes or arrays. Indexing Related to indexing on series/frames, not to indexes themselves and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Dec 29, 2020
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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants