Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Issue AttributeError: ‘numpy.ndarray’ object has no attribute ‘index’

# import numpy library
import numpy as np

# create NumPy array
my_array = np.array([3, 5, 2, 1, 6, 9, 8, 4])

# find the largest number in numpy array
largest_num = np.max(my_array)
print("Largest number in array is", largest_num)

# find the index of largest number
my_array.index(largest_num)
Source by itsmycode.com #
 
PREVIOUS NEXT
Tagged: #Issue #object #attribute
ADD COMMENT
Topic
Name
9+6 =