Skip to content

Commit b4753f1

Browse files
committed
CLN: Simplify the type promote conditions in combine
1 parent 0d96869 commit b4753f1

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
@@ -4881,13 +4881,11 @@ def combine(self, other, func, fill_value=None, overwrite=True):
48814881
pass
48824882
else:
48834883
# if we have different dtypes, possibly promote
4884-
new_dtype = this_dtype
4885-
if not is_dtype_equal(this_dtype, other_dtype):
4886-
new_dtype = find_common_type([this_dtype, other_dtype])
4887-
if not is_dtype_equal(this_dtype, new_dtype):
4888-
series = series.astype(new_dtype)
4889-
if not is_dtype_equal(other_dtype, new_dtype):
4890-
otherSeries = otherSeries.astype(new_dtype)
4884+
new_dtype = find_common_type([this_dtype, other_dtype])
4885+
if not is_dtype_equal(this_dtype, new_dtype):
4886+
series = series.astype(new_dtype)
4887+
if not is_dtype_equal(other_dtype, new_dtype):
4888+
otherSeries = otherSeries.astype(new_dtype)
48914889

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

0 commit comments

Comments
 (0)