Skip to content

Commit 0f72afd

Browse files
author
aschade
committed
TST: Fixed test failure
1 parent 27673ff commit 0f72afd

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pandas/core/internals.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,7 +1051,7 @@ def f(m, v, i):
10511051

10521052
return [self.make_block(new_values)]
10531053

1054-
def coerce_to_target_dtype(self, other):
1054+
def coerce_to_target_dtype(self, other, force_coericion=False):
10551055
"""
10561056
coerce the current block to a dtype compat for other
10571057
we will return a block, possibly object, and not raise
@@ -1067,7 +1067,7 @@ def coerce_to_target_dtype(self, other):
10671067
return self
10681068

10691069
if self.is_bool or is_object_dtype(dtype) or is_bool_dtype(dtype):
1070-
if is_float_dtype(dtype) or is_integer_dtype(dtype):
1070+
if force_coericion and is_float_dtype(dtype) or is_integer_dtype(dtype):
10711071
return self.astype(dtype)
10721072
else:
10731073
return self.astype(object)
@@ -1351,7 +1351,7 @@ def eval(self, func, other, errors='raise', try_cast=False, mgr=None):
13511351
values, values_mask, other, other_mask = self._try_coerce_args(
13521352
transf(values), other)
13531353
except TypeError:
1354-
block = self.coerce_to_target_dtype(orig_other)
1354+
block = self.coerce_to_target_dtype(orig_other, True)
13551355
return block.eval(func, orig_other,
13561356
errors=errors,
13571357
try_cast=try_cast, mgr=mgr)

0 commit comments

Comments
 (0)