ValueError: The elements are 0-sized

Viewed 407

Haven't been able to find any information on the web about this problem. I'm trying to read from a text file using numpy.

data = np.fromfile("C:\Users\Dan\Desktop\elements.txt",dtype=str,count=-1,sep=' ')

When I run this code I get this error:

ValueError: The elements are 0-sized.

I've never seen this error before, and a Google search didn't return any information about this error. Why is this error occurring, and how can I get around it?

EDIT: Here is an excerpt from the text file

1   Hydrogen 1.008      
2   Helium  4.002602
3   Lithium 6.94    
4   Beryllium 9.0121831
5   Boron 10.81 
6   Carbon 12.011
1 Answers
Related