convert column to integer pandas code example
Example 1: column dataframe to int
df[[column_name]].astype(int)
Example 2: convert column to numeric pandas
df = df.apply(pd.to_numeric)
df[["a", "b"]] = df[["a", "b"]].apply(pd.to_numeric)
Example 3: make string numeric pandas
df['DataFrame Column'] = df['DataFrame Column'].astype(int)
Example 4: convert pandas series from str to int
df['DataFrame Column'] = pd.to_numeric(df['DataFrame Column'])
Example 5: convert a pandas column to int
my_series = pd.to_numeric(my_series)
df["a"] = pd.to_numeric(df["a"])
Example 6: set column datatype pandas
df = pd.read_csv("weather.tsv", sep="\t",
dtype={'Day': str,'Wind':int64})
df.dtypes