# How do you denoise and extract features from EEG data with Python?

I have EEG data with 5 columns (1 per each electrode) and I need to denoise it and extract features from it using Python. I tried to find relevant packages but my search kept leading me to MNE which takes as input data in a format that I don't have. My data is in a pandas dataframe.

my questions are:

1. How do you denoise such dataset?
2. How do you do feature extraction for it?

Thanks :)

• Are you asking for a different python package, or a reference for how to do these, or a general explanation? If it's the last two, then you don't need the word "Python" in the title. – uhoh Feb 24 '19 at 4:24
• If you are looking for a python-based EEG analyzing toolbox, have you tried PyEEG (pyeeg.sourceforge.net)? – Cloudy Feb 25 '19 at 12:49
• I recommend updating the Q based on the comments, as the Q is vague; do you need Python script or general help? If the latter, the question is too broad to begin with. – AliceD Feb 26 '19 at 19:45
• Wow this is so exciting topic – Always Confused Sep 10 '19 at 13:50

you can convert your data frame to numpy array using

data=df.to_numpy()


If your data is single trial meanining two dimensional dataset, you can use

channel_names=df.columns.tolist()
channel_types=len(channel_names)*['eeg']
sfreq = 1000  # in Hertz
montage = 'standard_1005'
info = mne.create_info(channel_names, sfreq, channel_types, montage)
raw = mne.io.RawArray(data, info)


If you have multitrials dataset

channel_names=df.columns.tolist()
channel_types=len(channel_names)*['eeg']
sfreq = 1000  # in Hertz
montage = 'standard_1005'
info = mne.create_info(channel_names, sfreq, channel_types, montage)
data=data.reshape(len(channel_names),-1,sfreq*time)
data=np.swapaxes(data,0,1)
epochs = mne.EpochsArray(sub, info)


Once you convert your dataset to mne structure, you can use mne filters and mne features