Here are two equivalent definitions of `Nr(...)`:

    _Nr = defaultdict(int)
    for count in self.values():
        _Nr[count] += 1
    # Special case for Nr[0]:
    _Nr[0] = bins - self.B() if bins is not None else 0

Or this one, even shorter:

    _Nr = Counter(self.values())
    # Special case for Nr[0]:
    _Nr[0] = bins - self.B() if bins is not None else 0

The latter is of course much nicer, but it's also 4x slower than the defaultdict version (using timeit on python 3.3).