Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.
exam questions

Exam Certified Associate Developer for Apache Spark All Questions

View all questions & answers for the Certified Associate Developer for Apache Spark exam

Exam Certified Associate Developer for Apache Spark topic 1 question 80 discussion

Which of the following code blocks returns the first 3 rows of DataFrame storesDF?

  • A. storesDF.top_n(3)
  • B. storesDF.n(3)
  • C. storesDF.take(3)
  • D. storesDF.head(3)
  • E. storesDF.collect(3)
Show Suggested Answer Hide Answer
Suggested Answer: C 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
azure_bimonster
9 months, 3 weeks ago
odd question indeed. head() and take() methods perform a similar operation of retrieving rows from the beginning of the DataFrame. However, head() may be slightly slower than take() due to additional checks for boundary conditions. I can't see the difference in terms of retrieving 1st three rows.
upvoted 2 times
...
newusername
1 year, 2 months ago
weird question, taking into account that head essentially calls take on the DataFrame.
upvoted 1 times
...
cookiemonster42
1 year, 3 months ago
C, D and even E are correct. There's no requirement to return a dataframe in the question
upvoted 2 times
...
ryanmu
1 year, 5 months ago
Correct answer is D. head(n) returns the first n rows and take(n) returns first n rows as a list
upvoted 3 times
zozoshanky
1 year, 4 months ago
Both head and take gives list as an output , am confused need to do more investigation
upvoted 2 times
...
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...