I want to read a text file into Python but I can't seem to do it. If I use np.loadtxt('file'), I get a URL error (not sure why...). If I use pandas it doesn't seem to parse the columns correctly. It looks like this:
0.0000000e+00 0.0000000e+00 0.0000000e+00 0.0000000e+00 0.0000000e+00 0.0000000e+00
-3.6344707e-03 -2.6598413e-02 8.4534688e-02 -8.6057356e-04 3.4833275e-04 -1.7481226e-05
-7.6545137e-03 -6.9117133e-02 1.0195991e-02 -1.1818548e-03 6.2261736e-04 -1.1414899e-04
I'm sure part of the issue is because the delimiter is 3 spaces but I can't seem to solve this.
Pandas would also be an acceptable alternative...
loadtxtshouldn't a problem with that file - provided you provide the right file name! If there wasurlerror, that means there was some problem accessing the file, by name or something else. NOT a problem with reading. Did you really use'file'in the loadtxt call?numpydelimiter : str, optional "The string used to separate values. By default, this is any whitespace." It appears it should not have any issues with your file, granted you are indeed importing the correct file.