Add a space in 2D array when writing a text file

I am trying to store a 2D vector into a .DAT file and I would like to add a space at the start of every row. An example of a desired output looks like this: 0.0000000E+00 0.0000000E+00 2.0020020E-03 0.0000000E+00 4.0040040E-03 0.0000000E+00 6.0060060E-03 0.0000000E+00 8.0080080E-03 0.0000000E+00 1.0010010E-02 0.0000000E+00 1.2012012E-02 0.0000000E+00 You can see at the front… Read More Add a space in 2D array when writing a text file

numpy genfromtxt IndexError when using comments

I’m trying to import data from a text file into python using genfromtxt(). The code I have currently is lowResOmni = np.genfromtxt(‘omni low res 7-14 to 7-18.txt’, dtype=[(‘year’, int), (‘SOY’, float) , (‘B’, float), (‘Bx’, float), (‘By’, float), (‘Bz’, float) , (‘plasmaTemp’, float), (‘ionDensity’, float), (‘plasmaSpeed’, float), (‘plasmaPressure’, float) , (‘pFlux1’, float), (‘pFlux2’, float), (‘pFlux4’,… Read More numpy genfromtxt IndexError when using comments