PySpark DataFrame | printSchema method
Start your free 7-days trial now!
printSchema(~) method prints the schema, that is, the columns' name and type of the DataFrame.
This method does not take in any parameters
Consider the following PySpark DataFrame:
Printing the name and type of each column (schema) in PySpark DataFrame
To obtain the schema, or the name and type of each column of our DataFrame:
df.printSchema()root|-- name: string (nullable = true)|-- age: long (nullable = true)