Last active
November 5, 2018 20:34
-
-
Save ajayborra/cfff92d6e96e1e10a8c364dc5f7ac2c7 to your computer and use it in GitHub Desktop.
Casting datatypes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// cast all the strings to Double type in Data Frame | |
val castedDF = df.columns.foldLeft(df)((current, c) => | |
current.withColumn(c, current(c).cast(DoubleType))) | |
castedDF.describe().show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment