Skip to content

Commit 2803662

Browse files
committed
BUG: Adjust cond shape to SparseBlock
SparseDataFrame.where passes n-length SparseBlock and (1, n)-shape condition block to Block.where.
1 parent 437f27f commit 2803662

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

pandas/core/internals.py

+3
Original file line numberDiff line numberDiff line change
@@ -1405,6 +1405,9 @@ def where(self, other, cond, align=True, raise_on_error=True,
14051405
if not hasattr(cond, 'shape'):
14061406
raise ValueError("where must have a condition that is ndarray "
14071407
"like")
1408+
else:
1409+
if self.is_sparse:
1410+
cond = cond.flatten()
14081411

14091412
# our where function
14101413
def func(cond, values, other):

0 commit comments

Comments
 (0)