Answers for "how to change data type of a column in pandas dataframe"

15

how to convert data type of a column in pandas

# You can use "astype" method
# suppose you want to correct your "sales" column data type
df['sales'] = df['sales'].astype('float64')
Posted by: Guest on July-20-2021
2

set type of column pandas

df.astype(int)
Posted by: Guest on November-30-2020

Code answers related to "how to change data type of a column in pandas dataframe"

Python Answers by Framework

Browse Popular Code Answers by Language