Last active
January 28, 2019 17:45
-
-
Save rssanders3/b6eb7e61142bf806de3fd06bf27aba0e to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| import org.apache.spark.sql.functions._ | |
| val allegiancesCleanupUDF = udf[String, String] (_.toLowerCase().replace("house ", "")) | |
| val isDeathUDF = udf{ deathYear: Integer => if(deathYear != null) 1 else 0} | |
| val gotCleaned = got.filter("Allegiances != \"None\"").withColumn("Allegiances", allegiancesCleanupUDF($"Allegiances")).withColumn("isDeath", isDeathUDF($"Death Year")) | |
| display(gotCleaned) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment