pyspark.RDD.getNumPartitions

RDD.getNumPartitions() → int

Returns the number of partitions in RDD

Examples

>>> rdd = sc.parallelize([1, 2, 3, 4], 2)
>>> rdd.getNumPartitions()
2