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

BUG: DataFrame.where with EA other (original) (raw)

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