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

Which of the following code blocks returns a DataFrame with column storeSlogan where single quotes in column storeSlogan in DataFrame storesDF have been replaced with double quotes?

A sample of DataFrame storesDF is below:

  • A. storesDF.withColumn("storeSlogan", col("storeSlogan").regexp_replace("’" "\""))
  • B. storesDF.withColumn("storeSlogan", regexp_replace(col("storeSlogan"), "’"))
  • C. storesDF.withColumn("storeSlogan", regexp_replace(col("storeSlogan"), "’", "\""))
  • D. storesDF.withColumn("storeSlogan", regexp_replace("storeSlogan", "’", "\""))
  • E. storesDF.withColumn("storeSlogan", regexp_extract(col("storeSlogan"), "’", "\""))
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
Sowwy1
7 months, 2 weeks ago
It's C. https://spark.apache.org/docs/latest/api/python/reference/pyspark.sql/api/pyspark.sql.functions.regexp_replace.html
upvoted 1 times
...
sionita
8 months ago
Why C and nod D ?
upvoted 1 times
jtu363
6 months, 1 week ago
needs a col object
upvoted 1 times
...
jtu363
6 months, 1 week ago
yes,D also works. disregard my previous comment.
upvoted 1 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 ...