To deal with mixed integer and NaN use a IntXXDType : >>> pd.to_numeric(df.age, errors='coerce').astype(pd.Int16Dtype()) 0 12 1 <NA> 2 <NA> ... ... <看更多>
This is in principle how integers are represented in the computer. Depending on the number of bytes used, only integer numbers between a minimum and a maximum ... ... <看更多>