I'm trying to get a Numpy array of arrays from a csv file Each row is meant to be an independent mumpy array within the general array. (relevant column names are 1,2,3....136).
I've tried this approach but I don't think it's the right way:
with open('faces_new.csv', 'r') as csvfile:
facesreader = list(csv.DictReader(csvfile, delimiter=',', quotechar='|'))
main_array = np.array()
for row in facesreader:
#create new array inside the main array
local_array = np.array()
for n in range(136):
local_array = np.append(float(row[str(n)]))
#add n to the array
main_array = np.append(local_array)
print(main_array)
np.array()raises an error. The use ofnp.appendis all wrong too. But if you insist on working this way, stick with list and list append.np.genfromtxtworks with normalcsvfiles. If there's something unusual about your file you need to give us a sample.