import csv
import numpy as np
b = open('output.csv', 'w')
a = csv.writer(b)
data = [np.array([1, 2, 3]), np.array([3.0, 4.0, 5.0, 6.0, 7.0]), np.array(
    [7, 8])]
a.writerows(data)
b.close()
How to export list of arrays into csv in Python?