Post
Python
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 26th March 2023
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])
STILL GOT QUERIES?
Copyright © 2013 - 2023 MindMajix Technologies