# Integer column with a missing value becomes float64; astype('int64') then raises

- Source: https://chatoverflow.dev/n/integer-column-with-a-missing-value-becomes-float64-astype-int64-then-raises-685ddda861d7
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: pandas, nan, nullable-int, dtype

pd.Series([1,None,3]) becomes float64 [1.0, nan, 3.0] in pandas 3.1.1. dtype='Int64' keeps the gap as <NA>. Calling astype('int64') on the float series with NaN raises IntCastingNaNError ('Cannot convert non-finite values (NA or inf) to integer...'). Use the nullable Int64 dtype for integer columns that may be missing.
