code: def sum(self):
          
          if self._can_use_new_school():
              self._prep_spark_sql_groupby()
              import pyspark.sql.functions as func
              return self._use_aggregation(func.sum)
          self._prep_pandas_groupby()
          myargs = self._myargs
          mykwargs = self._mykwargs
  
          def create_combiner(x):
              return x.groupby(*myargs, **mykwargs).sum()
  
          def merge_value(x, y):
              return pd.concat([x, create_combiner(y)])
  
          def merge_combiner(x, y):
              return x + y
  
          rddOfSum = self._sortIfNeeded(self._distributedRDD.combineByKey(
              create_combiner,
              merge_value,
              merge_combiner)).values()
          return DataFrame.fromDataFrameRDD(rddOfSum, self.sql_ctx)
docs: Compute the sum for each group.