Certified Associate Developer for Apache Spark Exam QuestionsBrowse all questions from this exam

Certified Associate Developer for Apache Spark Exam - Question 176


Which of the following code blocks returns a DataFrame where rows in DataFrame storesDF containing missing values in every column have been dropped?

Show Answer
Correct Answer: D

To drop rows in a DataFrame where all columns contain missing values, you can use the `na.drop('all')` function in PySpark. This option specifies that rows will only be dropped if all values in the row are NaN. Therefore, the correct option is storesDF.na.drop('all').

Discussion

1 comment
Sign in to comment
jtu363Option: D
May 15, 2024

https://spark.apache.org/docs/3.1.2/api/python/reference/api/pyspark.sql.DataFrame.dropna.html