Skip to content

Commit

Permalink
try try again
Browse files Browse the repository at this point in the history
  • Loading branch information
jreback committed Jul 4, 2017
1 parent b2eef2d commit 14327a7
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions pandas/core/internals.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,10 +384,14 @@ def fillna(self, value, limit=None, inplace=False, downcast=None,

# fillna, but if we cannot coerce, then try again as an ObjectBlock
try:
print("_try_coerce_args: {}".format(value))
values, _, _, _ = self._try_coerce_args(self.values, value)
print("putmask")
blocks = self.putmask(mask, value, inplace=inplace)
print("coerce")
blocks = [b.make_block(values=self._try_coerce_result(b.values))
for b in blocks]
print("downcast")
return self._maybe_downcast(blocks, downcast)
except (TypeError, ValueError):

Expand All @@ -397,16 +401,11 @@ def fillna(self, value, limit=None, inplace=False, downcast=None,

# operate column-by-column
def f(m, v, i):
print("value: {}".format(value))
print("block: {}".format(self))
# try again with a compatible block
block = self.coerce_to_target_dtype(value)
print("coerced block: {}".format(block))

return block.fillna(value,
limit=limit,
inplace=inplace,
downcast=False)
downcast=None)

return self.split_and_operate(mask, f, inplace)

Expand Down

0 comments on commit 14327a7

Please sign in to comment.