code: def _prep_pandas_groupby(self):
          
          myargs = self._myargs
          mykwargs = self._mykwargs
  
          def extract_keys(groupedFrame):
              for key, group in groupedFrame:
                  yield (key, group)
  
          def group_and_extract(frame):
              return extract_keys(frame.groupby(*myargs, **mykwargs))
  
          self._baseRDD = self._prdd._rdd()
          self._distributedRDD = self._baseRDD.flatMap(group_and_extract)
          self._mergedRDD = self._sortIfNeeded(
              self._group(self._distributedRDD))
docs: Prepare the old school pandas group by based approach.