简体   繁体   English

'IndexError:数组索引过多'

[英]'IndexError: too many indices for array'

I am trying to teach myself NumPy in Jupyter Notebooks:我正在尝试在 Jupyter Notebooks 中自学 NumPy:

I have an array called 'study_minutes'我有一个名为“study_minutes”的数组

But when trying to access using study_minutes[1, 0] or study_minutes[(1, 0)] , I get an error:但是当尝试使用study_minutes[1, 0]study_minutes[(1, 0)]访问时,我得到一个错误:

---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-1-0fb6eb80a6ee> in <module>
----> 1 study_minutes[1, 1] = 360

NameError: name 'study_minutes' is not defined

The source code from the tutorial I am using gives the same error,我正在使用的教程中的源代码给出了同样的错误,

Any idea why guys?知道为什么吗? I am stumped我很难过

Many thanks,非常感谢,

Are you sure is too many indices error?你确定是太多索引错误吗? The last NameError is saying that you did not initialize the array.最后一个 NameError 表示您没有初始化数组。 If you still getting the error and you think is due to the too many indices error check this solution如果您仍然收到错误并且您认为是由于索引错误过多, 请检查此解决方案

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM