numpy_append函数

  numpyappend函数用于合并多个数组。

import numpy as np

a = np.append([1, 2, 3], [[4, 5, 6], [7, 8, 9]])
print("a =", a)
b = np.append([[1, 2, 3], [4, 5, 6]], [[7, 8, 9]], axis=0)
print("b =", b)

执行结果:

a = [1 2 3 4 5 6 7 8 9]
b = [[1 2 3]
     [4 5 6]
     [7 8 9]]

你可能感兴趣的:(python,numpy)