Column.
cast
Convert the column into type dataType.
dataType
New in version 1.3.0.
Examples
>>> df.select(df.age.cast("string").alias('ages')).collect() [Row(ages='2'), Row(ages='5')] >>> df.select(df.age.cast(StringType()).alias('ages')).collect() [Row(ages='2'), Row(ages='5')]