You are viewing documentation about an older version (1.3.0). View latest version

snowflake.snowpark.functions.replace¶

snowflake.snowpark.functions.replace(subject: ColumnOrName, pattern: ColumnOrLiteralStr, replacement: ColumnOrLiteralStr = '') → Column[source]¶

Removes all occurrences of a specified subject and optionally replaces them with replacement.

Example:

>>> df = session.create_dataframe([["apple"], ["apple pie"], ["apple juice"]], schema=["a"])
>>> df.select(replace(col("a"), "apple", "orange").alias("result")).show()
----------------
|"RESULT"      |
----------------
|orange        |
|orange pie    |
|orange juice  |
----------------
Copy