Created
May 15, 2020 18:31
-
-
Save siakon89/ff0f3c79f000cdb304e2bdf185b977fb 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
# Reading a CSV | |
df = spark.read.csv("filename.csv") | |
# Reading a CSV with header | |
df = spark.read.csv("filename.csv", header=True) | |
# Reading a CSV using the load method | |
df = spark.read.format("csv").load("filename.csv") | |
# Reading a CSV using the load method with header | |
df = spark.read.format("csv").\ | |
option("header", "true").\ | |
load("filename.csv") | |
# The same goes for different formats | |
df = spark.read.format("<file format>"). \ | |
load("filename.<format>") | |
# Or using the given method | |
df = sparl.read.<format method>.("filename.<format>) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment