I have the following in my code:
import numpy as np
b=np.loadtxt("abc.xyz")
My abc.xyz file is like following:
A 1.0400000 0.0620770 0.0479419
A 2.0060000 2.4675657 -0.0229796
A 3.0700000 0.0490902 1.5524933
B 4.0090000 2.4494762 1.4444613
A 2.0040000 1.2139214 3.1270965
I keep getting this error:
ValueError: could not convert string to float: 'A'
How to fix this issue? Thank you in advance.
loadtxtas a default reads the whole line, and tries to convert each element to float. The error arises because the first valueAdoes not represent a number.