def entropy(X, base=2):
    """Calculates the entropy, H(X), in the given base

    Parameters
    ----------
    X: array-like (# samples)
        An array of values for which to compute the entropy
    base: integer (default: 2)
        The base in which to calculate entropy

    Returns
    ----------
    entropy: float
        The entropy calculated according to the equation H(X) = -sum(p_x * log p_x) for all states of X

    """
    return scipy.stats.entropy(list(Counter(X).values()), base=base)