1# You can use "astype" method
2# suppose you want to correct your "sales" column data type
3df['sales'] = df['sales'].astype('float64')
1>>> df.astype({'col1': 'int32'}).dtypes
2col1 int32
3col2 int64
4dtype: object
1# convert all columns of DataFrame
2df = df.apply(pd.to_numeric) # convert all columns of DataFrame
3
4# convert just columns "a" and "b"
5df[["a", "b"]] = df[["a", "b"]].apply(pd.to_numeric)
6
1# convert Series
2my_series = pd.to_numeric(my_series)
3
4# convert column "a" of a DataFrame
5df["a"] = pd.to_numeric(df["a"])
6
1df = pd.read_csv("weather.tsv", sep="\t",
2 dtype={'Day': str,'Wind':int64})
3df.dtypes
4