You need to call getNumPartitions() on the DataFrame's underlying RDD, e.g., df.rdd.getNumPartitions().
In the case of Scala, this is a parameterless method: df.rdd.getNumPartitions.
If you want to know more about Spark, then do check out this awesome video tutorial: