def annualize_returns(returns, periods_in_year):
    """
    Annualizes a set of returns
    :param returns: the vector of returns
    :param periods_in_year: periods in year that returns are awarded
    """
    return (returns + 1).prod() ** (periods_in_year / len(returns)) - 1