Could you add here:

    else:
        raise ValueError("`rtype` has to be one of {'max', 'min', 'avg'}")