def ff_analysis(r, factors):
    '\n    Returns the loadings  of r on the Fama French Factors\n    which can be read in using get_fff_returns()\n    the index of r must be a (not necessarily proper) subset of the index of factors\n    r is either a Series or a DataFrame\n    '
    if isinstance(r, pd.Series):
        dependent_variable = r
        explanatory_variables = factors.loc[r.index]
        tilts = regress(dependent_variable, explanatory_variables).params
    elif isinstance(r, pd.DataFrame):
        tilts = pd.DataFrame({col: ff_analysis(r[col], factors) for col in r.columns})
    else:
        raise TypeError('r must be a Series or a DataFrame')
    return tilts
Returns the loadings  of r on the Fama French Factors
which can be read in using get_fff_returns()
the index of r must be a (not necessarily proper) subset of the index of factors
r is either a Series or a DataFrame
def ff_analysis(r, factors):
    '\n    Returns the loadings  of r on the Fama French Factors\n    which can be read in using get_fff_returns()\n    the index of r must be a (not necessarily proper) subset of the index of factors\n    r is either a Series or a DataFrame\n    '
    if isinstance(r, pd.Series):
        dependent_variable = r
        explanatory_variables = factors.loc[r.index]
        tilts = regress(dependent_variable, explanatory_variables).params
    elif isinstance(r, pd.DataFrame):
        tilts = pd.DataFrame({col: ff_analysis(r[col], factors) for col in r.columns})
    else:
        raise TypeError('r must be a Series or a DataFrame')
    return tilts