pyspark.sql.DataFrame.__getattr__¶
-
DataFrame.
__getattr__
(name: str) → pyspark.sql.column.Column[source]¶ Returns the
Column
denoted byname
.New in version 1.3.0.
Changed in version 3.4.0: Supports Spark Connect.
Examples
>>> df = spark.createDataFrame([ ... (2, "Alice"), (5, "Bob")], schema=["age", "name"])
Retrieve a column instance.
>>> df.select(df.age).show() +---+ |age| +---+ | 2| | 5| +---+