当前位置:   article > 正文

numpy.float64不能当作列表索引_list indices must be integers or slices, not numpy

list indices must be integers or slices, not numpy.float64

在python中,列表索引必须是integer,不能是float类型,包括numpy.float64比如

  1. l = [1,2,3,4]
  2. l[1.0]

这样是不行的,会报错

  1. Traceback (most recent call last):
  2. File "<stdin>", line 1, in <module>
  3. TypeError: list indices must be integers or slices, not float

 如果用numpy.float64会报如下错误

  1. Traceback (most recent call last):
  2. File "c:\Users\threads.py", line 314, in run
  3. execute_task()
  4. File "c:\Users\daily.py", line 379, in istka_stable_filter15
  5. partual_data = self.stka_data[start: end]
  6. TypeError: slice indices must be integers or None or have an __index__ method

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小小林熬夜学编程/article/detail/642892
推荐阅读
相关标签
  

闽ICP备14008679号