'Export data in tabular structure as a pandas DataFrame.
Columns and indices will depend on the object being converted.
Generally this will include as much relevant information as
possible for the data type being converted. This makes it easy
to convert data for use in packages that utilize dataframes,
such as statsmodels or seaborn.
Parameters
picks : array-like of int | None
If None only MEG and EEG channels are kept
otherwise the channels indices in picks are kept.
index : tuple of str | None
Column to be used as index for the data. Valid string options
are \'epoch\', \'time\' and \'condition\'. If None, all three info
columns will be included in the table as categorial data.
scale_time : float
Scaling to be applied to time units.
scalings : dict | None
Scaling to be applied to the channels picked. If None, defaults to
``scalings=dict(eeg=1e6, grad=1e13, mag=1e15, misc=1.0)``.
copy : bool
If true, data will be copied. Else data may be modified in place.
start : int | None
If it is a Raw object, this defines a starting index for creating
the dataframe from a slice. The times will be interpolated from the
index and the sampling rate of the signal.
stop : int | None
If it is a Raw object, this defines a stop index for creating
the dataframe from a slice. The times will be interpolated from the
index and the sampling rate of the signal.
Returns
df : instance of pandas.core.DataFrame
A dataframe suitable for usage with other
statistical/plotting/analysis packages. Column/Index values will
depend on the object type being converted, but should be
human-readable.'

def to_data_frame(self, picks=None, index=None, scale_time=1000.0, scalings=None, copy=True, start=None, stop=None):

    from ..epochs import BaseEpochs
    from ..evoked import Evoked
    from ..source_estimate import _BaseSourceEstimate
    pd = _check_pandas_installed()
    mindex = list()
    if isinstance(self, _BaseSourceEstimate):
        if (self.subject is None):
            default_index = ['time']
        else:
            default_index = ['subject', 'time']
        data = self.data.T
        times = self.times
        shape = data.shape
        mindex.append(('subject', np.repeat(self.subject, shape[0])))
        if isinstance(self.vertices, list):
            col_names = [i for e in [['{0}    {1}'.format(('LH' if (ii < 1) else 'RH'), vert) for vert in vertno] for (ii, vertno) in enumerate(self.vertices)] for i in e]
        else:
            col_names = ['VOL    {0}'.format(vert) for vert in self.vertices]
    elif isinstance(self, (BaseEpochs, BaseRaw, Evoked)):
        picks = self._get_check_picks(picks, self.ch_names)
        if isinstance(self, BaseEpochs):
            default_index = ['condition', 'epoch', 'time']
            data = self.get_data()[:, picks, :]
            times = self.times
            (n_epochs, n_picks, n_times) = data.shape
            data = np.hstack(data).T
            times = np.tile(times, n_epochs)
            id_swapped = dict(((v, k) for (k, v) in self.event_id.items()))
            names = [id_swapped[k] for k in self.events[:, 2]]
            mindex.append(('condition', np.repeat(names, n_times)))
            mindex.append(('epoch', np.repeat(np.arange(n_epochs), n_times)))
            col_names = [self.ch_names[k] for k in picks]
        elif isinstance(self, (BaseRaw, Evoked)):
            default_index = ['time']
            if isinstance(self, BaseRaw):
                (data, times) = self[picks, start:stop]
            elif isinstance(self, Evoked):
                data = self.data[picks, :]
                times = self.times
            data = data.T
            col_names = [self.ch_names[k] for k in picks]
        types = [channel_type(self.info, idx) for idx in picks]
        n_channel_types = 0
        ch_types_used = []
        scalings = _handle_default('scalings', scalings)
        for t in scalings.keys():
            if (t in types):
                n_channel_types += 1
                ch_types_used.append(t)
        for t in ch_types_used:
            scaling = scalings[t]
            idx = [i for i in range(len(picks)) if (types[i] == t)]
            if (len(idx) > 0):
                data[:, idx] *= scaling
    else:
        raise NameError(('Object    must    be    one    of    Raw,    Epochs,    Evoked,        or    ' + 'SourceEstimate.    This    is    {0}'.format(type(self))))
    times = np.round((times * scale_time))
    mindex.append(('time', times))
    if (index is not None):
        _check_pandas_index_arguments(index, default_index)
    else:
        index = default_index
    if (copy is True):
        data = data.copy()
    assert all(((len(mdx) == len(mindex[0])) for mdx in mindex))
    df = pd.DataFrame(data, columns=col_names)
    for (i, (k, v)) in enumerate(mindex):
        df.insert(i, k, v)
    if (index is not None):
        if ('time' in index):
            logger.info('Converting    time    column    to    int64...')
            df['time'] = df['time'].astype(np.int64)
        df.set_index(index, inplace=True)
    if all(((i in default_index) for i in index)):
        df.columns.name = 'signal'
    return df
