Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# 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