pyspark.sql.functions.map_values

pyspark.sql.functions.map_values(col: ColumnOrName) → pyspark.sql.column.Column

Collection function: Returns an unordered array containing the values of the map.

Parameters
colColumn or str

name of column or expression

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]|
+------+