Quantcast
Viewing all articles
Browse latest Browse all 24

Answer by manishbelsare for How can I change column types in Spark SQL's DataFrame?

Java code for modifying the datatype of the DataFrame from String to Integer

df.withColumn("col_name", df.col("col_name").cast(DataTypes.IntegerType))

It will simply cast the existing(String datatype) to Integer.


Viewing all articles
Browse latest Browse all 24

Trending Articles