我正在尝试将一个新列附加到数组中,没有错误,但什么也没有发生。。。能告诉我我做错了什么吗
import numpy as np
from numpy.lib import recfunctions
from numpy.lib.recfunctions import append_fields
#the_array = np.genfromtxt(file.csv, ...) dimensions 170 rows, 25 columns
jrows = np.ma.size(the_array)
the_field = np.zeros(jrows)
the_field[:] = 391
append_fields(the_array, 'minute', data = the_field)
#no errors, but nothing appended.
NumPy中几乎没有任何内容会改变现有阵列的结构
append_fields
返回一个新的数组,您可以忽略并丢弃该数组。这确实应该在文档中提到,但是文档目前没有列出返回值,这使得它看起来像是一个变异函数无论如何,不要忽略返回值:
相关问题 更多 >
编程相关推荐