Skip to content

Commit cd0efe1

Browse files
authored
ENH: Add solution guidance to IntCastingNaNError message (#62838) (#63044)
1 parent e95175c commit cd0efe1

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pandas/core/dtypes/astype.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,9 @@ def _astype_float_to_int_nansafe(
144144
"""
145145
if not np.isfinite(values).all():
146146
raise IntCastingNaNError(
147-
"Cannot convert non-finite values (NA or inf) to integer"
147+
"Cannot convert non-finite values (NA or inf) to integer."
148+
"Replace or remove non-finite values or cast to an integer type"
149+
"that supports these values (e.g. 'Int64')"
148150
)
149151
if dtype.kind == "u":
150152
# GH#45151

0 commit comments

Comments
 (0)