Skip to content

Commit

Permalink
BUG: Add fillna so that cond doesnt contain NA at the beginning of _w…
Browse files Browse the repository at this point in the history
…here. (pandas-dev#60729)
  • Loading branch information
sanggon6107 committed Jan 23, 2025
1 parent 60325b8 commit bc9a942
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -9674,6 +9674,12 @@ def _where(
if axis is not None:
axis = self._get_axis_number(axis)

# We should not be filling NA. See GH#60729
if isinstance(cond, np.ndarray):
cond[np.isnan(cond)] = True
elif isinstance(cond, NDFrame):
cond = cond.fillna(True)

# align the cond to same shape as myself
cond = common.apply_if_callable(cond, self)
if isinstance(cond, NDFrame):
Expand Down

0 comments on commit bc9a942

Please sign in to comment.