Skip to content

Commit cf1f18b

Browse files
Licht-Tgfyoung
authored andcommitted
CLN: Simplify the type promote conditions in combine
1 parent ed86732 commit cf1f18b

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

pandas/core/frame.py

+5-7
Original file line numberDiff line numberDiff line change
@@ -5084,13 +5084,11 @@ def combine(self, other, func, fill_value=None, overwrite=True):
50845084
pass
50855085
else:
50865086
# if we have different dtypes, possibly promote
5087-
new_dtype = this_dtype
5088-
if not is_dtype_equal(this_dtype, other_dtype):
5089-
new_dtype = find_common_type([this_dtype, other_dtype])
5090-
if not is_dtype_equal(this_dtype, new_dtype):
5091-
series = series.astype(new_dtype)
5092-
if not is_dtype_equal(other_dtype, new_dtype):
5093-
otherSeries = otherSeries.astype(new_dtype)
5087+
new_dtype = find_common_type([this_dtype, other_dtype])
5088+
if not is_dtype_equal(this_dtype, new_dtype):
5089+
series = series.astype(new_dtype)
5090+
if not is_dtype_equal(other_dtype, new_dtype):
5091+
otherSeries = otherSeries.astype(new_dtype)
50945092

50955093
# see if we need to be represented as i8 (datetimelike)
50965094
# try to keep us at this dtype

0 commit comments

Comments
 (0)