This tutorial will explain with examples how to use array_position, array_contains and array_remove array functions in Pyspark.

PySpark: Dataframe Array Functions Part 3

This tutorial will explain with examples how to use array_position, array_contains and array_remove array functions in Pyspark. Other array functions can be viewed by clicking functions in the below list.



array_position: This function can be used to find index of a particular element in the array column. Also it will only return position of first occurence. Position function assume first index as 1 and it will return 0 (zero) if value is not present in the array. It is available to import from Pyspark Sql function library.


array_contains: This function can be used to check if the particular value is present in the array or not. It is available to import from Pyspark Sql function library.


array_remove: This function can be used to remove particular element from the array column. It will remove all the occurrence of that element. It is available to import from Pyspark Sql function library.