snowflake.snowpark.functions.replace

snowflake.snowpark.functions.replace(subject: Union[Column, str], pattern: Union[Column, str], replacement: Union[Column, str] = '') Column[source] (https://github.com/snowflakedb/snowpark-python/blob/v1.16.0/src/snowflake/snowpark/functions.py#L2748-L2773)

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
语言: 中文