pyspark.sql.DataFrame.dtypes¶
-
property
DataFrame.
dtypes
¶ Returns all column names and their data types as a list.
New in version 1.3.0.
Changed in version 3.4.0: Supports Spark Connect.
- Returns
- list
List of columns as tuple pairs.
Examples
>>> df = spark.createDataFrame( ... [(14, "Tom"), (23, "Alice"), (16, "Bob")], ["age", "name"]) >>> df.dtypes [('age', 'bigint'), ('name', 'string')]