def var(self, values, axis=0, weights=None, dtype=None):
    'compute the variance over each group\n\n        Parameters\n        ----------\n        values : array_like, [keys, ...]\n            values to take variance of per group\n        axis : int, optional\n            alternative reduction axis for values\n\n        Returns\n        -------\n        unique: ndarray, [groups]\n            unique keys\n        reduced : ndarray, [groups, ...]\n            value array, reduced over groups\n        '
    values = np.asarray(values)
    (unique, mean) = self.mean(values, axis, weights, dtype)
    err = (values - mean.take(self.inverse, axis))
    if (weights is None):
        shape = ([1] * values.ndim)
        shape[axis] = self.groups
        group_weights = self.count.reshape(shape)
        var = self.reduce((err ** 2), axis=axis, dtype=dtype)
    else:
        weights = np.asarray(weights)
        group_weights = self.reduce(weights, axis=axis, dtype=dtype)
        var = self.reduce((weights * (err ** 2)), axis=axis, dtype=dtype)
    return (unique, (var / group_weights))
compute the variance over each group

Parameters
----------
values : array_like, [keys, ...]
    values to take variance of per group
axis : int, optional
    alternative reduction axis for values

Returns
-------
unique: ndarray, [groups]
    unique keys
reduced : ndarray, [groups, ...]
    value array, reduced over groups
def var(self, values, axis=0, weights=None, dtype=None):
    'compute the variance over each group\n\n        Parameters\n        ----------\n        values : array_like, [keys, ...]\n            values to take variance of per group\n        axis : int, optional\n            alternative reduction axis for values\n\n        Returns\n        -------\n        unique: ndarray, [groups]\n            unique keys\n        reduced : ndarray, [groups, ...]\n            value array, reduced over groups\n        '
    values = np.asarray(values)
    (unique, mean) = self.mean(values, axis, weights, dtype)
    err = (values - mean.take(self.inverse, axis))
    if (weights is None):
        shape = ([1] * values.ndim)
        shape[axis] = self.groups
        group_weights = self.count.reshape(shape)
        var = self.reduce((err ** 2), axis=axis, dtype=dtype)
    else:
        weights = np.asarray(weights)
        group_weights = self.reduce(weights, axis=axis, dtype=dtype)
        var = self.reduce((weights * (err ** 2)), axis=axis, dtype=dtype)
    return (unique, (var / group_weights))