def mode(self, values, weights=None):
    'compute the mode within each group.\n\n        Parameters\n        ----------\n        values : array_like, [keys, ...]\n            values to compute the mode of per group\n        weights : array_like, [keys], float, optional\n            optional weight associated with each entry in values\n\n        Returns\n        -------\n        unique: ndarray, [groups]\n            unique keys\n        reduced : ndarray, [groups, ...]\n            value array, reduced over groups\n        '
    if (weights is None):
        (unique, weights) = npi.count((self.index.sorted_group_rank_per_key, values))
    else:
        (unique, weights) = npi.group_by((self.index.sorted_group_rank_per_key, values)).sum(weights)
    (x, bin) = npi.group_by(unique[0]).argmax(weights)
    return (x, unique[1][bin])
compute the mode within each group.

Parameters
----------
values : array_like, [keys, ...]
    values to compute the mode of per group
weights : array_like, [keys], float, optional
    optional weight associated with each entry in values

Returns
-------
unique: ndarray, [groups]
    unique keys
reduced : ndarray, [groups, ...]
    value array, reduced over groups
def mode(self, values, weights=None):
    'compute the mode within each group.\n\n        Parameters\n        ----------\n        values : array_like, [keys, ...]\n            values to compute the mode of per group\n        weights : array_like, [keys], float, optional\n            optional weight associated with each entry in values\n\n        Returns\n        -------\n        unique: ndarray, [groups]\n            unique keys\n        reduced : ndarray, [groups, ...]\n            value array, reduced over groups\n        '
    if (weights is None):
        (unique, weights) = npi.count((self.index.sorted_group_rank_per_key, values))
    else:
        (unique, weights) = npi.group_by((self.index.sorted_group_rank_per_key, values)).sum(weights)
    (x, bin) = npi.group_by(unique[0]).argmax(weights)
    return (x, unique[1][bin])