Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Cannot convert non-finite values (NA or inf) to integer

# single column
df['column_name'].apply(pd.to_numeric).astype('Int64')

# range of cols
df.loc[:, 'col_n':'col_m'] = df.loc[:, 'col_n':'col_m'].apply(pd.to_numeric).astype('Int64')

'''
From Pandas v0.24, introduces Nullable Integer Data Types 
which allows integers to coexist with NaNs.
'''
 
PREVIOUS NEXT
Tagged: #Cannot #convert #values #integer
ADD COMMENT
Topic
Name
6+7 =