I have a cvs file which has three columns of numbers up to three digits each:
1 0 0
2 0 0
3 0 0
4 0 0
5 0 0
6 0 0
7 0 0
8 0 0
9 0 0
10 0 0
11 0 0
I want to read the columns separately and be able to use them as arrays with:
data = np.loadtxt('file.csv')
x = data[:, 0]
y = data[:, 1]
But I'm getting:
X = np.array(X, dtype)
ValueError: setting an array element with a sequence.
If instead I use the line x,y = np.loadtxt('Beamprofile.txt', usecols=(0,1), unpack=True)
the error disappears but x and y don't seem to be read correctly in further operations.