snowflake.snowpark.functions.array_slice¶
- snowflake.snowpark.functions.array_slice(array: Union[Column, str], from_: Union[Column, str], to: Union[Column, str]) Column[source] (https://github.com/snowflakedb/snowpark-python/blob/v1.23.0/src/snowflake/snowpark/functions.py#L5642-L5670)¶
- Returns an ARRAY constructed from a specified subset of elements of the input ARRAY. - Parameters:
- array – Column containing the source ARRAY. 
- from – Column containing a position in the source ARRAY. The position of the first element is 0. Elements from positions less than this parameter are not included in the resulting ARRAY. 
- to – Column containing a position in the source ARRAY. Elements from positions equal to or greater than this parameter are not included in the resulting array. 
 
 - Example::
- >>> from snowflake.snowpark import Row >>> df = session.create_dataframe([Row(a=[1, 2, 3, 4, 5])]) >>> df.select(array_slice("a", lit(1), lit(3)).alias("result")).show() ------------ |"RESULT" | ------------ |[ | | 2, | | 3 | |] | ------------