Home

Published

- 1 min read

how to convert data type of a column in pandas

img of how to convert data type of a column in pandas

The solution for this is noted below

how to convert data type of a column in pandas

Solution

   # You can use "astype" method
# suppose you want to correct your "sales" column data type
df['sales'] = df['sales'].astype('float64')

Try other methods by searching on the site. That is if this doesn’t work