pyspark.sql.Column.getItem¶
-
Column.
getItem
(key)[source]¶ An expression that gets an item at position
ordinal
out of a list, or gets an item by key out of a dict.New in version 1.3.0.
Examples
>>> df = spark.createDataFrame([([1, 2], {"key": "value"})], ["l", "d"]) >>> df.select(df.l.getItem(0), df.d.getItem("key")).show() +----+------+ |l[0]|d[key]| +----+------+ | 1| value| +----+------+