Databricks Certified Associate Developer for Apache Spark — Question 153
The code block shown below should return a new DataFrame that is the result of a position-wise union between DataFrame storesDF and DataFrame acquiredStoresDF. Choose the response that correctly fills in the numbered blanks within the code block to complete this task.
Code block:
__1__.__2__(__3__)
Answer options
- A. 1. DataFrame 2. union 3. storesDF, acquiredStoresDF
- B. 1. DataFrame 2. concat 3. storesDF, acqulredStoresDF
- C. 1. storesDF 2. union 3.acquiredStoresDF
- D. 1. storesDF 2. unionByName 3. acquiredStoresDF
- E. 1. DataFrame 2. unionAll 3. storesDF, acquiredStoresDF
Correct answer: C
Explanation
The correct answer is C because 'storesDF.union(acquiredStoresDF)' correctly uses the union method on the storesDF DataFrame to combine it with acquiredStoresDF. Options A, B, D, and E are incorrect due to either using the wrong method (like concat or unionAll) or having typographical errors in the DataFrame names.