Posted on 29th April 2025|105 views
How to resolve the error “too many indices for an array”?
I am getting an error called too many indices for an array here is my code
import numpy as np
y = np.array([311,116,8,118,007,185,13])
print(y[0,3])
Posted on 29th April 2025| views
The only problem is you have declared a single dimension array using a numpy library, but in your code, you are trying to print it as a two-dimensional array better try this:
import numpy as np
y = np.array([311,116,8,118,007,185,13])
print(y[0])