<p>you can convert your data frame to numpy array using </p>

<pre><code>data=df.to_numpy()
</code></pre>

<p>If your data is single trial meanining two dimensional dataset, you can use</p>

<pre><code>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)
</code></pre>

<p>If you have multitrials dataset</p>

<pre><code>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)
</code></pre>

<p>Once you <a href="https://martinos.org/mne/stable/auto_tutorials/simulation/plot_creating_data_structures.html" rel="nofollow noreferrer">convert your dataset to mne structure</a>, you can use <a href="https://martinos.org/mne/dev/generated/mne.filter.filter_data.html" rel="nofollow noreferrer">mne filters</a> and <a href="https://github.com/mne-tools/mne-features" rel="nofollow noreferrer">mne features</a></p>

CC BY-SA 4.0
2019-07-16T05:12:08.447Z
2019-07-16T05:12:08.447Z
Talha Anwar
<p>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.</p>

<p>my questions are:</p>

<ol>
<li>How do you denoise such dataset? </li>
<li>How do you do feature extraction for it?</li>
</ol>

<p>Thanks :)</p>

CC BY-SA 4.0
2019-02-24T04:24:26.623Z
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
CC BY-SA 4.0
2019-02-25T12:49:28.907Z
If you are looking for a python-based EEG analyzing toolbox, have you tried PyEEG (http://pyeeg.sourceforge.net/)?
Cloudy
CC BY-SA 4.0
2019-02-26T19:45:23.660Z
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
<eeg><neurology>
How do you denoise and extract features from EEG data with Python?
Mayu
# How do you denoise and extract features from EEG data with Python?

(Asked by: username_0 on 2019-02-23)

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 :)

**Tags:** eeg, neurology

> **Comments:**
> **username_1**: 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.  
> **username_2**: If you are looking for a python-based EEG analyzing toolbox, have you tried PyEEG (http://pyeeg.sourceforge.net/)?  
> **username_3**: 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.  

---

## 1 answers

### Answer by username_4 on 2019-07-16. Score: 1

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


---

