解决 TypeError: slice indices must be integers or None or have an __index__ method

Define the value of part,
Insert picture description here
use the value in part in turn using a loop

    for i in part:
        x = spike[i:i+scale,:]

At this time an error occurs.
Insert picture description here
The variable i can be forced to int to solve it.

    for i in part:
        x = spike[int(i):int(i+scale),:]

Guess you like

Origin blog.csdn.net/Peggiehu/article/details/107203590