I faced a problem with writing structured array in txt file. Having an output file (outfile) opened, I use the following numpy function:
np.savetxt(*outfile*, ***recarray***, fmt=['%s','%-7.4f','%-7.4f','%-7.4f'])
The recarray is like [ (b'H', 0.9425, 0.1412, 7.1414) ... (b'N', 1.0037, 4.0524, 6.8000) ], where the first element has numpy.bytes_ type and others are numpy.float64.
An error message appears while writing this recarray in file:
TypeError: must be str, not bytes
So, what is the easiest way to put this array in file? Maybe there is another function?