Answers for "cannot safely cast non-equivalent float64 to int64"

0

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)
Posted by: Guest on March-08-2022

Python Answers by Framework

Browse Popular Code Answers by Language