Which of the following code blocks returns a new DataFrame with column storeDescription where the pattern "Description: " has been removed from the beginning of column storeDescription in DataFrame storesDF?
A sample of DataFrame storesDF is below:
A. storesDF.withColumn("storeDescription", regexp_replace(col("storeDescription"), "^Description: "))
B. storesDF.withColumn("storeDescription", col("storeDescription").regexp_replace("^Description: ", ""))
C. storesDF.withColumn("storeDescription", regexp_extract(col("storeDescription"), "^Description: ", ""))
D. storesDF.withColumn("storeDescription", regexp_replace("storeDescription", "^Description: ", ""))
E. storesDF.withColumn("storeDescription", regexp_replace(col("storeDescription"), "^Description: ", ""))
Which of the following code blocks returns a new DataFrame with column storeDescription where the pattern "Description:
-
- Site Admin
- Posts: 899559
- Joined: Mon Aug 02, 2021 8:13 am