成功解决IndexError: index 0 is out of bounds for axis 1 with size 0

简介: 成功解决IndexError: index 0 is out of bounds for axis 1 with size 0

解决问题


IndexError: index 0 is out of bounds for axis 1 with size 0





解决思路


查看列表,输出列表内容,查看列表的形状,发现列表的确是空值,所以修改列表内容即可!


print(list.shape)




解决方法


y = train_np[:, 0]

print(train_np)  

#修改列表的内容使其不为空列表即可!

大功告成!哈哈!


相关文章
成功解决but is 0 and 2 (computed from start 0 and end 9223372 over shape with rank 2 and stride-1)
成功解决but is 0 and 2 (computed from start 0 and end 9223372 over shape with rank 2 and stride-1)
|
索引 Python
Python报错:IndexError: index 0 is out of bounds for axis 0 with size 0
Python报错:IndexError: index 0 is out of bounds for axis 0 with size 0
372 0
The size of tensor a (4) must match the size of tensor b (3) at non-singletonThe size of
The size of tensor a (4) must match the size of tensor b (3) at non-singletonThe size of
996 0
|
索引 Python
成功解决ValueError: column index (256) not an int in range(256)
成功解决ValueError: column index (256) not an int in range(256)
成功解决ValueError: column index (256) not an int in range(256)
|
Linux Python
ValueError: empty range for randrange() (0, 0, 0)
ValueError: empty range for randrange() (0, 0, 0)
|
数据库
Data truncation: Out of range value for column ‘estimate_score‘
Data truncation: Out of range value for column ‘estimate_score‘
成功解决IndexError: index 14 is out of bounds for axis 1 with size 14
成功解决IndexError: index 14 is out of bounds for axis 1 with size 14
成功解决np.array(zip(x1, x2)).reshape(len(x1), 2) ValueError: cannot reshape array of size 1 int
成功解决np.array(zip(x1, x2)).reshape(len(x1), 2) ValueError: cannot reshape array of size 1 int
成功解决numpy.core._internal.AxisError: axis -1 is out of bounds for array of dimension 0
成功解决numpy.core._internal.AxisError: axis -1 is out of bounds for array of dimension 0