成功解决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)  

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

大功告成!哈哈!


相关文章
|
5月前
|
索引 Python
row[i] = col[j] = TrueIndexError: list assignment index out of range
row[i] = col[j] = TrueIndexError: list assignment index out of range
|
索引 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
318 0
成功解决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)
LeetCode 149. Max Points on a Line
给定一个二维平面,平面上有 n 个点,求最多有多少个点在同一条直线上。
96 0
LeetCode 149. Max Points on a Line
|
索引 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