I have two string-arrays that have to follow each other row-wise and afterwards they have to be written in a text file
import numpy as np
title1 = np.array(['text1'])
title2 = np.array(['text2'])
np.savetxt('result.csv',(title1, title2),fmt="%s")
result should be a file starting with:
text1
text2
but it´s more like this:
text1text2
the second problem is below these two rows of text I need to put a matrix (mine is much bigger) in the next row('s). The entries of the matrix should be spaced with a semicolon ";" - at the end of row there shouldn't be one(!)
a=np.array([[1.2,2.3,3.4],[4.5,5.6,6.7],[7.8,8.8,9.8]])
np.savetxt('test.csv', a, delimiter=';', fmt='%.1f')
resulting file should look like this:
text1
text2
1.2;2.3;3.4
4.5;5.6;6.7
7.8;8.8;9.8
the above code does not put the next rows of entries to the next row in my output file. (when opening it with notepad it does not, in excel it seems to work. How can I combine strings and numbers in my output in the way I described?