错误:AttributeError:“ builtin_function_or_method”对象没有属性“ append”

时间:2020-07-17 06:21:24

标签: python numpy

以下代码引发错误Error: AttributeError: 'builtin_function_or_method' object has no attribute 'append'

 salary=np.array
    rescaled=np.array
    for item in finance_features:
        salary.append(item[0])
        rescaled.append(item[1])
    print salary
    print rescaled

请可以帮助我的人,我先感谢

1 个答案:

答案 0 :(得分:0)

如何定义一个空的numpy数组并使用np.append附加到for循环内部的数组中?

salary=np.array([])
rescaled=np.array([])

for item in zip(range(10), range(10,20)):
    salary = np.append(salary, item[0])
    rescaled = np.append(rescaled, item[1])
print(salary)
print(rescaled)
相关问题