snowflake.snowpark.functions.position¶

snowflake.snowpark.functions.position(expr1: Union[Column, str], expr2: Union[Column, str], start_pos: int = 1) → Column[source]¶

Searches for the first occurrence of the first argument in the second argument and, if successful, returns the position (1-based) of the first argument in the second argument.

Example:

>>> df = session.create_dataframe([['an', 'banana'], ['nan', 'banana']], schema=["expr1", "expr2"])
>>> df.select(position(df["expr1"], df["expr2"], 3).alias("position")).collect()
[Row(POSITION=4), Row(POSITION=3)]
Copy