Column.
getField
An expression that gets a field by name in a StructType.
StructType
New in version 1.3.0.
Changed in version 3.4.0: Supports Spark Connect.
a literal value, or a Column expression. The result will only be true at a location if the field matches in the Column.
Column
Deprecated since version 3.0.0: Column as a parameter is deprecated.
Column representing whether each element of Column got by name.
Examples
>>> from pyspark.sql import Row >>> df = spark.createDataFrame([Row(r=Row(a=1, b="b"))]) >>> df.select(df.r.getField("b")).show() +---+ |r.b| +---+ | b| +---+ >>> df.select(df.r.a).show() +---+ |r.a| +---+ | 1| +---+