我正在寻找一种将 .edf 文件读入熊猫数据框的方法。
它们是制表符分隔的 - 正如我检查简单的 excel 文件一样。但是,以下命令不起作用,并引发以下错误。我还尝试了 pyedfilb(基于少量在线资源),但没有成功。您可以在此处下载文件。
https://drive.google.com/file/d/1TeSVX6z2j1os6Bj1nYmB3WLMJb2JYb6Z/view?usp=sharing
import pandas as pd
#import pyedflib
df = pd.read_csv('500psi_6in_0deg.edf', sep = '\t')
print (df)
输出
Traceback (most recent call last):
File "C:/Users/kundemj/Desktop/Spray Savvy/Tests & Measurements/2021-0090 Data Files/PostProcessing/main.py", line 7, in <module>
df = pd.read_csv('500psi_6in_0deg.edf', sep = '\t')#, header=None)
File "C:\Python37\lib\site-packages\pandas\io\parsers.py", line 676, in parser_f
return _read(filepath_or_buffer, kwds)
File "C:\Python37\lib\site-packages\pandas\io\parsers.py", line 454, in _read
data = parser.read(nrows)
File "C:\Python37\lib\site-packages\pandas\io\parsers.py", line 1133, in read
ret = self._engine.read(nrows)
File "C:\Python37\lib\site-packages\pandas\io\parsers.py", line 2037, in read
data = self._reader.read(nrows)
File "pandas\_libs\parsers.pyx", line 860, in pandas._libs.parsers.TextReader.read
File "pandas\_libs\parsers.pyx", line 875, in pandas._libs.parsers.TextReader._read_low_memory
File "pandas\_libs\parsers.pyx", line 929, in pandas._libs.parsers.TextReader._read_rows
File "pandas\_libs\parsers.pyx", line 916, in pandas._libs.parsers.TextReader._tokenize_rows
File "pandas\_libs\parsers.pyx", line 2071, in pandas._libs.parsers.raise_parser_error
pandas.errors.ParserError: Error tokenizing data. C error: Expected 1 fields in line 9, saw 12