Save numpy based array in different rows of an excel file
excel, numpy, python
Solution
Assuming that `data` is a list of your arrays, and that you made sure that all your arrays have same size, you can use `np.savetxt` to save your `data` to a TSV/CSV file, as suggested by @Qnan
np.savetxt(your_output_file, np.array(data), delimiter="\t")
Check the `np.savetxt` documentation for more information on how to format the fields, if needed.
The idea is to write the file at once, instead of line by line.
Problem
I have a code that generates an `numpy.array` in each loop. I want to save the array as a row in an excel file (i.e., the array created in the first loop becomes the first row, the array generated in the 2nd loop becomes the 2nd row and so on). The array is created in the following way: for loop in `range(0,10)`: ``` Array1 = ..... Array2 = ...... Array3 = numpy.concatenate((Array1,Array2),axis=0) ``` Any idea how I can put Array3 in 10 different rows of an excel file? (If the array is 5 dimensional, the excel file should contain 10 rows and 5 columns).