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 73 discussion

Which of the following code blocks returns a new DataFrame where column sqft from DataFrame storesDF has had its missing values replaced with the value 30,000?

A sample of DataFrame storesDF is below:

  • A. storesDF.na.fill(30000, Seq("sqft"))
  • B. storesDF.nafill(30000, col("sqft"))
  • C. storesDF.na.fill(30000, col("sqft"))
  • D. storesDF.fillna(30000, col("sqft"))
  • E. storesDF.na.fill(30000, "sqft")
Show Suggested Answer Hide Answer
Suggested Answer: E 🗳️

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
Samir_91
5 months, 2 weeks ago
Selected Answer: E
E is answer
upvoted 3 times
...
Samir_91
5 months, 3 weeks ago
E is answer. It's tested. A)AttributeError: module 'pyspark.sql.functions' has no attribute 'Seq' B)AttributeError: 'DataFrame' object has no attribute 'nafill' C)PySparkTypeError: [NOT_LIST_OR_TUPLE] Argument `subset` should be a list or tuple, got Column. D)PySparkTypeError: [NOT_LIST_OR_TUPLE] Argument `subset` should be a list or tuple, got Column.
upvoted 3 times
...
hosniadel666
8 months, 1 week ago
Selected Answer: A
Check fill function at scala API docs https://spark.apache.org/docs/3.0.0/api/scala/org/apache/spark/sql/DataFrameNaFunctions.html#fill(value:Long,cols:Array%5BString%5D):org.apache.spark.sql.DataFrame
upvoted 1 times
...
azure_bimonster
9 months, 2 weeks ago
Selected Answer: C
To me C is likely correct, because we need to use col() C. storesDF.na.fill(30000, col("sqft"))
upvoted 1 times
...
learnsh1
9 months, 3 weeks ago
typo error I THINK 1st arg is col name right ?
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 ...