def coerce_to_target_dtype(self, other):
<EOL>dtype, _ = infer_dtype_from(other, pandas_dtype=True)<EOL>if is_dtype_equal(self.dtype, dtype):<EOL><INDENT>return self<EOL><DEDENT>if self.is_bool or is_object_dtype(dtype) or is_bool_dtype(dtype):<EOL><INDENT>return self.astype(object)<EOL><DEDENT>elif ((self.is_float or self.is_complex) and<EOL>(is_integer_dtype(dtype) or is_float_dtype(dtype))):<EOL><INDENT>return self<EOL><DEDENT>elif (self.is_datetime or<EOL>is_datetime64_dtype(dtype) or<EOL>is_datetime64tz_dtype(dtype)):<EOL><INDENT>if not ((is_datetime64_dtype(dtype) or<EOL>is_datetime64tz_dtype(dtype)) and self.is_datetime):<EOL><INDENT>return self.astype(object)<EOL><DEDENT>mytz = getattr(self.dtype, '<STR_LIT>', None)<EOL>othertz = getattr(dtype, '<STR_LIT>', None)<EOL>if str(mytz) != str(othertz):<EOL><INDENT>return self.astype(object)<EOL><DEDENT>raise AssertionError("<STR_LIT>"<EOL>"<STR_LIT>".format(<EOL>self, other))<EOL><DEDENT>elif (self.is_timedelta or is_timedelta64_dtype(dtype)):<EOL><INDENT>if not (is_timedelta64_dtype(dtype) and self.is_timedelta):<EOL><INDENT>return self.astype(object)<EOL><DEDENT>raise AssertionError("<STR_LIT>"<EOL>"<STR_LIT>".format(<EOL>self, other))<EOL><DEDENT>try:<EOL><INDENT>return self.astype(dtype)<EOL><DEDENT>except (ValueError, TypeError, OverflowError):<EOL><INDENT>pass<EOL><DEDENT>return self.astype(object)<EOL>
coerce the current block to a dtype compat for other
we will return a block, possibly object, and not raise

we can also safely try to coerce to the same dtype
and will receive the same block