def to_return_index(dataframe, ticker_col='RIC_CD', date_col='MARKETDATE'):
    """
    Transform TRQA Return Index into EQI Factor format.
    :param dataframe: TRQA Return Index dataframe
    :param ticker_col: ticker column name
    :param date_col: date column name
    :return: TRQA Return Index in EQI Factor format
    """
    return dataframe.to_eqi().e_rename({ticker_col: 'asset', date_col: 'Date'}
        ).e_select('Date', 'asset', 'RI').e_set_index('Date', 'asset'
        ).e_groupby('asset').e_apply(lambda df: df.to_eqi().e_groupby(
        'Date').sum().to_pandas()).unstack(0).e_drop_level(0).resample('d'
        ).bfill().sort_index().to_pandas()
