pyspark.sql.DataFrame.count¶
-
DataFrame.
count
() → int[source]¶ Returns the number of rows in this
DataFrame
.New in version 1.3.0.
Changed in version 3.4.0: Supports Spark Connect.
- Returns
- int
Number of rows.
Examples
>>> df = spark.createDataFrame( ... [(14, "Tom"), (23, "Alice"), (16, "Bob")], ["age", "name"])
Return the number of rows in the
DataFrame
.>>> df.count() 3