
Calling astype on Python Pandas series with unconvertible values?
Use errors=’ignore’ to skip the error:
s = pd.Series([10, np.nan, 30])
s.astype('int8') # raises IntCastingNaNError
s.astype('int8', errors='ignore') # keeps original dtype

Calling astype on Python Pandas series with unconvertible values?
Use errors=’ignore’ to skip the error:
s = pd.Series([10, np.nan, 30])
s.astype('int8') # raises IntCastingNaNError
s.astype('int8', errors='ignore') # keeps original dtype