COMPAT: numpy compat with 1-ndim object array compat and broadcasting (#14809)

xref #14808
(cherry picked from commit 0412732222)
This commit is contained in:
Jeff Reback 2016-12-06 08:00:30 -05:00 committed by Joris Van den Bossche
parent 11eb8abac0
commit 13f28f558b
1 changed files with 7 additions and 0 deletions

View File

@ -1176,6 +1176,13 @@ def _arith_method_FRAME(op, name, str_rep=None, default_axis='columns',
yrav = y.ravel()
mask = notnull(xrav) & notnull(yrav)
xrav = xrav[mask]
# we may need to manually
# broadcast a 1 element array
if yrav.shape != mask.shape:
yrav = np.empty(mask.shape, dtype=yrav.dtype)
yrav.fill(yrav.item())
yrav = yrav[mask]
if np.prod(xrav.shape) and np.prod(yrav.shape):
with np.errstate(all='ignore'):