Reputation: 941
I am working with data imported from a huge CSV. Pandas changed some columns to float, so now the numbers in these columns get displayed as floating points! However, I need them to be integers. I found some solutions, but all used the column names to change the dtypes.
Is there a way to change the data type for example for the first one thousand columns without addressing them separately by their names?
Upvotes: 0
Views: 1072
Reputation: 210842
df.iloc[:, :1000] = df.iloc[:, :1000].astype(int)
Upvotes: 1