I read data from a .csv file to a Pandas dataframe as below. For one of the columns, namely id, I want to specify the column type as int. The probl
id
int
I had the problem a few weeks ago with a few discrete features which were formatted as 'object'. This solution seemed to work.
for col in discrete: df[col] = pd.to_numeric(df[col], errors='coerce').astype(pd.Int64Dtype())