Google News
logo
PySpark - Quiz(MCQ)
Which of the following is used to read data from a file in PySpark?
A)
readTextFile()
B)
writeTextFile()
C)
readDataFrame()
D)
writeDataFrame()

Correct Answer :   readTextFile()


Explanation : readTextFile() is used to read data from a file in PySpark. It reads the contents of a file and creates an RDD with each line of the file as an element. Other file input/output operations in PySpark include read.csv(), read.json(), write.csv(), and write.json().

Advertisement