📌  相关文章
📜  [已解决]AttributeError: 'numpy.ndarray' 对象没有属性 'index' - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:42.728000             🧑  作者: Mango

代码示例1
# 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)

# print the index of largest number
print(np.where(my_array == largest_num))