我有 x_train,这是一个属于数据波形的数组,维度为 (475,1501),我希望最终输出 (seg2) 为 (1425,500)。我尝试了以下代码:
count=0
sega=[]
seg2=[]
for i in range (0,len(x_train)):
sega = x_train[i][:(x_train[i].size // 500) * 500].reshape(-1, 500)
seg2[count:(count+1),500] = sega
count = count + i
但它抱怨以下错误:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-137-72281c805a83> in <module>
10 sega = x_train[i][:(x_train[i].size // 500) * 500].reshape(-1, 500)
11 print(sega.shape)
---> 12 seg2[count:(count+1),500] = sega
13 count = count + i
14
TypeError: list indices must be integers or slices, not tuple
我该如何解决这个错误?
翻翻过去那场雪
相关分类