Created
May 29, 2017 20:01
-
-
Save dhesse/7f253e2414db0bb21e775f1e343c5581 to your computer and use it in GitHub Desktop.
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
# assume a spark context is given as sc | |
# and a spark sql context as | |
rdd = (sc.textFile('data.csv') | |
.map(lambda x: x.split(';')) | |
.map(lambda x: Row(name = x[0], | |
age = int(x[1])))) | |
df = spark.createDataFrame(rdd) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment