- MNE version: 1.6.0
- operating system: Windows 11
I have a series of EEG data recorded with medua server provided by others , the recordings get four files, their txt opens with the contents as shown in the picture. The .dat file is too large for my computer to open in txt.
I have referred to other questions within the forum about opening .dat files and I understand that the core idea is to use other functions to read them and then convert them to raw objects.
However, when reading the .dat file using numpy, pandas and pickle in turn, the encoding error occurs, please help me find a solution, thank you.
The code and the screenshot of the error report are in the post in turn.
#fname = 'xx.dat'
import numpy as np
import matplotlib.pyplot as plt
data = numpy.loadtxt(fname)
data = data.T
plt.plot(*data)
plt.show()
UnicodeDecodeError: ‘gbk’ codec can’t decode byte 0xd2 in position 2: illegal multibyte sequence
import pandas
import matplotlib.pyplot as plt
data = pandas.read_csv(fname)
data = data.T
plt.plot(*data)
plt.show()
UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0xce in position 0: invalid continuation byte
The encoding method tried GB2312, gb18030, ISO-8859-1, and the error is reported as follows
‘gb2312’ codec can’t decode byte 0xce in position 0: illegal multibyte sequence
‘gb18030’ codec can’t decode byte 0xd2 in position 2: illegal multibyte sequence
ISO-8859-1:Error tokenizing data. C error: Expected 2 fields in line 4, saw 3
The original file is about 300MB, since I’m from China I chose BaiduNetdisk to provide the file, if you can’t get it or there are other ways please let me know, thanks.
Link to original file:https://pan.baidu.com/s/1zalW8ZLcs5X9eiF29g1T9A?pwd=abcd
Extract code: abcd