change datatype of pyspark df code example
Example 1: pyspark import stringtype
from pyspark.sql.types import StringType
Example 2: pyspark cast column to long
changedTypedf = joindf.withColumn("label", joindf["show"].cast("double"))
// types = ['BinaryType', 'BooleanType', 'ByteType', 'DateType',
// 'DecimalType', 'DoubleType', 'FloatType', 'IntegerType',
// 'LongType', 'ShortType', 'StringType', 'TimestampType']