def get_ind_file(filetype, weighting='vw', n_inds=30):
    '\n    Load and format the Ken French Industry Portfolios files\n    Variant is a tuple of (weighting, size) where:\n        weighting is one of "ew", "vw"\n        number of inds is 30 or 49\n    '
    if (filetype is 'returns'):
        name = f'{weighting}_rets'
        divisor = 100
    elif (filetype is 'nfirms'):
        name = 'nfirms'
        divisor = 1
    elif (filetype is 'size'):
        name = 'size'
        divisor = 1
    else:
        raise ValueError(f'filetype must be one of: returns, nfirms, size')
    ind = (pd.read_csv(f'data/ind{n_inds}_m_{name}.csv', header=0, index_col=0, na_values=(- 99.99)) / divisor)
    ind.index = pd.to_datetime(ind.index, format='%Y%m').to_period('M')
    ind.columns = ind.columns.str.strip()
    return ind
Load and format the Ken French Industry Portfolios files
Variant is a tuple of (weighting, size) where:
    weighting is one of "ew", "vw"
    number of inds is 30 or 49
def get_ind_file(filetype, weighting='vw', n_inds=30):
    '\n    Load and format the Ken French Industry Portfolios files\n    Variant is a tuple of (weighting, size) where:\n        weighting is one of "ew", "vw"\n        number of inds is 30 or 49\n    '
    if (filetype is 'returns'):
        name = f'{weighting}_rets'
        divisor = 100
    elif (filetype is 'nfirms'):
        name = 'nfirms'
        divisor = 1
    elif (filetype is 'size'):
        name = 'size'
        divisor = 1
    else:
        raise ValueError(f'filetype must be one of: returns, nfirms, size')
    ind = (pd.read_csv(f'data/ind{n_inds}_m_{name}.csv', header=0, index_col=0, na_values=(- 99.99)) / divisor)
    ind.index = pd.to_datetime(ind.index, format='%Y%m').to_period('M')
    ind.columns = ind.columns.str.strip()
    return ind