code: def nth(self, n, *args, **kwargs):
          
          # TODO: Stop collecting the entire frame for each key.
          self._prep_pandas_groupby()
          myargs = self._myargs
          mykwargs = self._mykwargs
          nthRDD = self._regroup_mergedRDD().mapValues(
              lambda r: r.nth(
                  n, *args, **kwargs)).values()
          return DataFrame.fromDataFrameRDD(nthRDD, self.sql_ctx)
docs: Take the nth element of each grouby.