pyspark.sql.functions.
map_values
Collection function: Returns an unordered array containing the values of the map.
New in version 2.3.0.
Changed in version 3.4.0: Supports Spark Connect.
Column
name of column or expression
values of the map as an array.
Examples
>>> from pyspark.sql.functions import map_values >>> df = spark.sql("SELECT map(1, 'a', 2, 'b') as data") >>> df.select(map_values("data").alias("values")).show() +------+ |values| +------+ |[a, b]| +------+