Reputation: 1
name, Ll, eLL, Mg= np.loadtxt('data.txt', comments='#', unpack=True)
Ntrials= sum(1 for line in open('data.txt'))
The data file contains four columns with values under every column Data file info
Does anyone know why I am getting that error?
Upvotes: 0
Views: 1728
Reputation: 61
You are trying to create 4 variables which are name, Ll, eLL, Mg, so make sure that you are getting 4 values from right hand side code.
np.loadtxt('data.txt', comments='#', unpack=True)
The above line must contain 4 values otherwise unpacking will not happen and ValueError will be thrown.
You can learn more about unpacking here: https://www.w3schools.com/python/python_tuples_unpack.asp
Upvotes: 1