Skip to content

Commit a6b461c

Browse files
always upcast, for predictability
1 parent 301d85f commit a6b461c

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

pandas/core/frame.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9156,7 +9156,7 @@ def combiner(x: Series, y: Series):
91569156
combined = combined.astype(other.dtypes)
91579157
else:
91589158
# GH#60128 Avoid precision loss from int64/uint64 <-> float64 round-trip.
9159-
def _cast_64_bit_ints_to_nullable(df: DataFrame) -> DataFrame:
9159+
def _promote_ints_to_nullable(df: DataFrame) -> DataFrame:
91609160
cast_map: dict[str, str] = {}
91619161

91629162
for col, dt in df.dtypes.items():
@@ -9167,11 +9167,8 @@ def _cast_64_bit_ints_to_nullable(df: DataFrame) -> DataFrame:
91679167

91689168
return df.astype(cast_map) if cast_map else df
91699169

9170-
# Only need to cast sides that gain rows on outer align (introduces <NA>).
9171-
if len(other.index.difference(self.index, sort=False)):
9172-
self = _cast_64_bit_ints_to_nullable(self)
9173-
if len(self.index.difference(other.index, sort=False)):
9174-
other = _cast_64_bit_ints_to_nullable(other)
9170+
self = _promote_ints_to_nullable(self)
9171+
other = _promote_ints_to_nullable(other)
91759172

91769173
combined = self.combine(other, combiner, overwrite=False)
91779174

0 commit comments

Comments
 (0)