I think that you cannot stack two arrays without the same shape according to numpy.stack . However, you can save the arrays sequentially to a csv file to obtain the result you seek. The following code must do the tricks.
import numpy as np
mat0 = np.random.randint(0, 10, (4, 1), dtype=int)
mat1 = np.random.randint(0, 10, (240, 320), dtype=int)
with open('foo.csv', 'w') as f:
np.savetxt(f, mat0, delimiter=',')
np.savetxt(f, mat1, delimiter=',')
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.