Casting a PySpark DataFrame column to a specific datatype Mon 30 December 2019 import pyspark.sql.functions as F from pyspark.sql.types import IntegerType # Cast the count column to an integer dataframe.withColumn("count", F.col("count").cast(IntegerType())) Python PySpark trick dataframe