def weight_msr(sigma, mu, scale=True):
    '\n    Optimal (Tangent/Max Sharpe Ratio) Portfolio weights\n    by using the Markowitz Optimization Procedure\n    Mu is the vector of Excess expected Returns\n    Sigma must be an N x N matrix as a DataFrame and Mu a column vector as a Series\n    This implements page 188 Equation 5.2.28 of\n    "The econometrics of financial markets" Campbell, Lo and Mackinlay.\n    '
    w = inverse(sigma).dot(mu)
    if scale:
        w = (w / sum(w))
    return w
Optimal (Tangent/Max Sharpe Ratio) Portfolio weights
by using the Markowitz Optimization Procedure
Mu is the vector of Excess expected Returns
Sigma must be an N x N matrix as a DataFrame and Mu a column vector as a Series
This implements page 188 Equation 5.2.28 of
"The econometrics of financial markets" Campbell, Lo and Mackinlay.
def weight_msr(sigma, mu, scale=True):
    '\n    Optimal (Tangent/Max Sharpe Ratio) Portfolio weights\n    by using the Markowitz Optimization Procedure\n    Mu is the vector of Excess expected Returns\n    Sigma must be an N x N matrix as a DataFrame and Mu a column vector as a Series\n    This implements page 188 Equation 5.2.28 of\n    "The econometrics of financial markets" Campbell, Lo and Mackinlay.\n    '
    w = inverse(sigma).dot(mu)
    if scale:
        w = (w / sum(w))
    return w