Skip to content

Commit f80917d

Browse files
clearer comments
1 parent fefadcb commit f80917d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

pandas/core/frame.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9026,7 +9026,9 @@ def combine(
90269026
2 NaN 3.0 1.0
90279027
"""
90289028

9029-
# GH#60128 Prevent lossy conversion of wide integers to float64.
9029+
# GH#60128 Integers n where |n| > 2**53 would lose precision after align
9030+
# upcasts them to float. Avoid lossy conversion by preemptively promoting
9031+
# int64 and uint64 Dtypes to their nullable EA Dtypes, Int64 and UInt64.
90309032
def _promote_wide_ints(df: DataFrame) -> DataFrame:
90319033
"""Promotes int64/uint64 columns to their nullable versions."""
90329034
cast_map: dict[str, str] = {}
@@ -9059,6 +9061,7 @@ def _restore_wide_ints(
90599061
dt for dt in (orig_dt_self, orig_dt_other) if dt is not None
90609062
]
90619063
if dtypes_to_resolve:
9064+
# if we had different dtypes, possibly promote
90629065
cast_map[col] = find_common_type(dtypes_to_resolve)
90639066

90649067
if cast_map:
@@ -9190,7 +9193,7 @@ def combine_first(self, other: DataFrame) -> DataFrame:
91909193
"""
91919194

91929195
def combiner(x: Series, y: Series):
9193-
# GH#60128 The combiner must preserve EA dtypes
9196+
# GH#60128 The combiner is supposed to preserve EA Dtypes.
91949197
return y if y.name not in self.columns else y.where(x.isna(), x)
91959198

91969199
if len(other) == 0:

0 commit comments

Comments
 (0)