Skip to content

Commit a53529a

Browse files
committed
Use putmask optimization
1 parent 5793ed2 commit a53529a

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

pandas/core/internals/blocks.py

+2-5
Original file line numberDiff line numberDiff line change
@@ -1014,6 +1014,7 @@ def putmask(self, mask, new, using_cow: bool = False) -> list[Block]:
10141014
----------
10151015
mask : np.ndarray[bool], SparseArray[bool], or BooleanArray
10161016
new : a ndarray/object
1017+
using_cow: bool, default False
10171018
10181019
Returns
10191020
-------
@@ -1227,11 +1228,7 @@ def fillna(
12271228
mask[mask.cumsum(self.ndim - 1) > limit] = False
12281229

12291230
if inplace:
1230-
if using_cow and self.refs.has_reference():
1231-
# TODO(CoW): If using_cow is implemented for putmask we can defer
1232-
# the copy
1233-
self = self.copy()
1234-
nbs = self.putmask(mask.T, value)
1231+
nbs = self.putmask(mask.T, value, using_cow=using_cow)
12351232
else:
12361233
# without _downcast, we would break
12371234
# test_fillna_dtype_conversion_equiv_replace

0 commit comments

Comments
 (0)