To do this, we first check the datatypes of columns from our real dataset:
The following is the output:
We then use the astype method to change the datatype. We pass float to the astype method and call this method on the column, the datatype of which we want to change.
We assign the change back to the original column as follows:
data['Zhvi'] = data.Zhvi.astype(float) data.dtypes
In the following screenshot, we can see that the change has been made—the datatype of our column has been changed from int64 to float64: