def plot_ef2(n_points, er, cov):
    '\n    Plots the 2-asset efficient frontier\n    '
    if ((er.shape[0] != 2) or (er.shape[0] != 2)):
        raise ValueError('plot_ef2 can only plot 2-asset frontiers')
    weights = [np.array([w, (1 - w)]) for w in np.linspace(0, 1, n_points)]
    rets = [portfolio_return(w, er) for w in weights]
    vols = [portfolio_vol(w, cov) for w in weights]
    ef = pd.DataFrame({'Returns': rets, 'Volatility': vols})
    return ef.plot.line(x='Volatility', y='Returns', style='.-')
Plots the 2-asset efficient frontier
def plot_ef2(n_points, er, cov):
    '\n    \n    '
    if ((er.shape[0] != 2) or (er.shape[0] != 2)):
        raise ValueError('plot_ef2 can only plot 2-asset frontiers')
    weights = [np.array([w, (1 - w)]) for w in np.linspace(0, 1, n_points)]
    rets = [portfolio_return(w, er) for w in weights]
    vols = [portfolio_vol(w, cov) for w in weights]
    ef = pd.DataFrame({'Returns': rets, 'Volatility': vols})
    return ef.plot.line(x='Volatility', y='Returns', style='.-')