Conversion method to Pandas DataFrame. To be attached to ResultDict.

    Returns
    -------
    main_effect, inter_effect: tuple
        A tuple of DataFrames for main effects and interaction effects.
        The second element (for interactions) will be `None` if not available.

def to_df(self):
    '''Conversion method to Pandas DataFrame. To be attached to ResultDict.

    Returns
    -------
    main_effect, inter_effect: tuple
        A tuple of DataFrames for main effects and interaction effects.
        The second element (for interactions) will be `None` if not available.
    '''
    names = self['names']
    main_effect = self['ME']
    interactions = self.get('IE', None)

    inter_effect = None
    if interactions:
        interaction_names = self.get('interaction_names')
        names = [name for name in names if not isinstance(name, list)]
        inter_effect = pd.DataFrame({'IE': interactions},
                                    index=interaction_names)

    main_effect = pd.DataFrame({'ME': main_effect}, index=names)

    return main_effect, inter_effect