DataFrame.
columns
Returns all column names as a list.
New in version 1.3.0.
Changed in version 3.4.0: Supports Spark Connect.
List of column names.
Examples
>>> df = spark.createDataFrame( ... [(14, "Tom"), (23, "Alice"), (16, "Bob")], ["age", "name"]) >>> df.columns ['age', 'name']