DATABRICKS-CERTIFIED-ASSOCIATE-DEVELOPER-FOR-APACHE-SPARK-3-0 practice question 15 of 25
In which order should the code blocks shown below be run in order to create a DataFrame that shows the mean of column predError of DataFrame…
Choose your answer, then check it against the explanation.
In which order should the code blocks shown below be run in order to create a DataFrame that
shows the mean of column predError of DataFrame transactionsDf per column storeId and productId,
where productId should be either 2 or 3 and the returned DataFrame should be sorted in ascending
order by column storeId, leaving out any nulls in that column?
DataFrame transactionsDf:
1.
+-------------+---------+-----+-------+---------+----+
2.
|transactionId|predError|value|storeId|productId| f|
3.
+-------------+---------+-----+-------+---------+----+
4.
|
1|
3|
4|
25|
1|null|
5.
|
2|
6|
7|
2|
2|null|
6.
|
3|
3| null|
25|
3|null|
7.
|
4|
null| null|
3|
2|null|
8.
|
5|
null| null| null|
2|null|
9.
|
6|
3|
2|
25|
2|null|
10.
+-------------+---------+-----+-------+---------+----+
1. .mean("predError")
2. .groupBy("storeId")
3. .orderBy("storeId")
4. transactionsDf.filter(transactionsDf.storeId.isNotNull())
5. .pivot("productId", [2, 3])
Question 15 of 25
Keep practicing
Take the free DATABRICKS-CERTIFIED-ASSOCIATE-DEVELOPER-FOR-APACHE-SPARK-3-0 practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other DATABRICKS-CERTIFIED-ASSOCIATE-DEVELOPER-FOR-APACHE-SPARK-3-0 practice questions
- Question 1The code block displayed below contains an error. The code block is intended to perform a…
- Question 2Which of the following code blocks shows the structure of a DataFrame in a tree-like way,…
- Question 3Which of the following code blocks reads the parquet file stored at filePath into DataFra…
- Question 4Which of the following code blocks returns a 2-column DataFrame that shows the distinct v…
- Question 5The code block shown below should return an exact copy of DataFrame transactionsDf that d…
- Question 6The code block displayed below contains an error. The code block should configure Spark t…
