📌  相关文章
📜  [已解决] TypeError: 'numpy.float64' 对象不能被解释为整数 - Python 代码示例

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

代码示例1
# import numpy library
import numpy as np

# create array of values in pandas
my_array = np.array([2.5, 6.4, 2.1, 7.4, 8.9, 1.1])

# covert values of array to integer using astype()
my_array = my_array.astype(int)
print("Converted array is", my_array)

#  print the range of values using for loop
for i in range(len(my_array)):
    print(range(my_array[i]))