使用HGD数据集时,需要从braindecode中调用相关的函数,但是在我的环境中运行时出现错误,现将解决过程记录,方便以后查阅。
运行HGD数据集的 example.py 文件
- ModuleNotFoundError: No module named ‘braindecode.datautil.signalproc‘
- AttributeError: module ‘numpy‘ has no attribute ‘str‘
- AttributeError: 'DataFrame' object has no attribute 'append'. Did you mean: '_append'?
- AttributeError: 'Series' object has no attribute 'iteritems'
ModuleNotFoundError: No module named ‘braindecode.datautil.signalproc‘
该问题是导入braindecode的版本太新了,需要使用如下的代码安装低版本的braindecode:
pip install https://github.com/TNTLFreiburg/braindecode/archive/master.zip
关于低版本的braindecode的使用手册如下:
https://robintibor.github.io/braindecode/index.html
AttributeError: module ‘numpy‘ has no attribute ‘str‘
同样是库的版本的问题,搜了一下我是用的库的函数,发现如下的函数:
因此把np.str
改成np.str_
,就可以了。
AttributeError: ‘DataFrame’ object has no attribute ‘append’. Did you mean: ‘_append’?
如下为出现错误的代码:
self.epochs_df = self.epochs_df.append(row_dict, ignore_index=True)
将上述代码修改为如下即可:
self.epochs_df = self.epochs_df._append(row_dict, ignore_index=True)
AttributeError: ‘Series’ object has no attribute ‘iteritems’
如下为出现错误的代码:
for key, val in last_row.iteritems():
将上述代码修改为如下即可:
for key, val in last_row.items():
因为在我是用的哭的版本中找到了如下的API,故做此修改。