Skip to content

Commit bc9a942

Browse files
committed
BUG: Add fillna so that cond doesnt contain NA at the beginning of _where. (pandas-dev#60729)
1 parent 60325b8 commit bc9a942

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pandas/core/generic.py

+6
Original file line numberDiff line numberDiff line change
@@ -9674,6 +9674,12 @@ def _where(
96749674
if axis is not None:
96759675
axis = self._get_axis_number(axis)
96769676

9677+
# We should not be filling NA. See GH#60729
9678+
if isinstance(cond, np.ndarray):
9679+
cond[np.isnan(cond)] = True
9680+
elif isinstance(cond, NDFrame):
9681+
cond = cond.fillna(True)
9682+
96779683
# align the cond to same shape as myself
96789684
cond = common.apply_if_callable(cond, self)
96799685
if isinstance(cond, NDFrame):

0 commit comments

Comments
 (0)