Hello,
I've been trying for a couple days to upload a csv file as a 2D matrix of numerical values (e.g. 1+2=3) so that I can extract individual numbers, rows, and, columns. I am using numpy. The input csv file is has four rows and three columns.
This is as close as I've gotten:
Thank you,
Ben
I've been trying for a couple days to upload a csv file as a 2D matrix of numerical values (e.g. 1+2=3) so that I can extract individual numbers, rows, and, columns. I am using numpy. The input csv file is has four rows and three columns.
This is as close as I've gotten:
import numpy as np import csv with open('C:\\Users\\...\\matrix.csv') as File: reader = csv.reader(File, delimiter=',') for data in reader: data = np.matrix(data, dtype=float) x = data.shape print (x)This gives me four 1x3 matrices instead of a 4x3 matrix. Thoughts?
Thank you,
Ben