Skip to content Skip to sidebar Skip to footer

Is It Possible To Add A New Field In A Numpy.genfromtxt Output?

I loaded a csv file and used the header to specify the names of each column. # Load the Data data = np.genfromtxt('dat_h.csv', delimiter=',',

Solution 1:

Look into this answer. Here are the docs for recfunctions.

Mainly I think what you need is this:

from numpy.lib.recfunctions import append_fields

append_fields(data, 'Pressure', pressure_vector, np.double)

Post a Comment for "Is It Possible To Add A New Field In A Numpy.genfromtxt Output?"