pyspark.sql.Column.__getattr__#
- Column.__getattr__(item)[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.
Changed in version 3.4.0: Supports Spark Connect.
- Parameters
- item
a literal value.
- Returns
Column
Column representing the item got by key out of a dict.
Examples
>>> df = spark.createDataFrame([('abcedfg', {"key": "value"})], ["l", "d"]) >>> df.select(df.d.key).show() +------+ |d[key]| +------+ | value| +------+