HyukjinKwon commented on code in PR #49348:
URL: https://github.com/apache/spark/pull/49348#discussion_r1901551767


##########
python/pyspark/sql/functions/builtin.py:
##########
@@ -15535,11 +15535,21 @@ def regexp_replace(
 
     Examples
     --------
+    >>> from pyspark.sql import functions as sf
     >>> df = spark.createDataFrame([("100-200", r"(\d+)", "--")], ["str", 
"pattern", "replacement"])
-    >>> df.select(regexp_replace('str', r'(\d+)', '--').alias('d')).collect()
-    [Row(d='-----')]
-    >>> df.select(regexp_replace("str", col("pattern"), 
col("replacement")).alias('d')).collect()
-    [Row(d='-----')]
+    >>> df.select('*', sf.regexp_replace('str', r'(\d+)', '--')).show()

Review Comment:
   can we write some explanation for individual examples?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to