Skip to content

Commit 8ea1bdf

Browse files
Licht-Tgfyoung
authored andcommitted
CLN: Simplify the type promote conditions in combine
1 parent 506b8e5 commit 8ea1bdf

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
@@ -5083,13 +5083,11 @@ def combine(self, other, func, fill_value=None, overwrite=True):
50835083
pass
50845084
else:
50855085
# if we have different dtypes, possibly promote
5086-
new_dtype = this_dtype
5087-
if not is_dtype_equal(this_dtype, other_dtype):
5088-
new_dtype = find_common_type([this_dtype, other_dtype])
5089-
if not is_dtype_equal(this_dtype, new_dtype):
5090-
series = series.astype(new_dtype)
5091-
if not is_dtype_equal(other_dtype, new_dtype):
5092-
otherSeries = otherSeries.astype(new_dtype)
5086+
new_dtype = find_common_type([this_dtype, other_dtype])
5087+
if not is_dtype_equal(this_dtype, new_dtype):
5088+
series = series.astype(new_dtype)
5089+
if not is_dtype_equal(other_dtype, new_dtype):
5090+
otherSeries = otherSeries.astype(new_dtype)
50935091

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

0 commit comments

Comments
 (0)