count number of rows in a dataframe pyspark code example Example: spark df shape print((df.count(), len(df.columns)))