Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

cannot safely cast non-equivalent float64 to int64

# try this: .round(0)
# set copy=False to modify inplace
df.loc[:, 'col_x':'col_y'] = df.loc[:, 'col_x':'col_y'].apply(pd.to_numeric).round(0).astype('Int64', copy=False)
 
PREVIOUS NEXT
Tagged: #safely #cast
ADD COMMENT
Topic
Name
5+7 =