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
1>>> s = pd.Series(["8", 6, "7.5", 3, "0.9"]) # mixed string and numeric values
2>>> s
30 8
41 6
52 7.5
63 3
74 0.9
8dtype: object
9
10>>> pd.to_numeric(s) # convert everything to float values
110 8.0
121 6.0
132 7.5
143 3.0
154 0.9
16dtype: float64
17
1df = pd.read_csv("weather.tsv", sep="\t",
2 dtype={'Day': str,'Wind':int64})
3df.dtypes
4