code: def npartitions(self):
          
          if self.mode == 'spark':
              return self.tordd().getNumPartitions()
          else:
              notsupported(self.mode)
docs: Get number of partitions (Spark only).