Build the distribution of distinct values

def distribution(self, limit=1024):
        """
        Build the distribution of distinct values
        """
        res = self._qexec("%s, count(*) as __cnt" % self.name(), group="%s" % self.name(),
                          order="__cnt DESC LIMIT %d" % limit)
        dist = []
        cnt = self._table.size()
        for i, r in enumerate(res):
            dist.append(list(r) + [i, r[1] / float(cnt)])

        self._distribution = pd.DataFrame(dist, columns=["value", "cnt", "r", "fraction"])
        self._distribution.index = self._distribution.r

        return self._distribution