Command
df.astype
Explanation
df.astype() is used to change the datatype of columns.
Examples
Convert column to integer
df["col"] = df["col"].astype(int)
Convert multiple columns at once
df = df.astype({"col1": float, "col2": "string"})
df.astype
df.astype() is used to change the datatype of columns.
Convert column to integer
df["col"] = df["col"].astype(int)
Convert multiple columns at once
df = df.astype({"col1": float, "col2": "string"})