1.vstack(),就是把多个数组以列的方式合并在一起。

>>> a = np.array([1, 2, 3])
>>> b = np.array([2, 3, 4])
>>> np.vstack((a,b))
array([[1, 2, 3],
       [2, 3, 4]])
>>> a = np.array([[1], [2], [3]])
>>> b = np.array([[2], [3], [4]])
>>> np.vstack((a,b))
array([[1],
       [2],
       [3],
       [2],
       [3],
       [4]])

2.reshape(),就改变数组形式。

numpy里面常用的函数

一行四列的数组通过reshape(-1,1)变为4行一列的形式。其中-1表示里面最终的行数,1表示列数。

numpy里面常用的函数

numpy里面常用的函数

numpy里面常用的函数

numpy里面常用的函数

numpy里面常用的函数

numpy里面常用的函数

numpy里面常用的函数

numpy里面常用的函数

numpy里面常用的函数

numpy里面常用的函数

numpy里面常用的函数

numpy里面常用的函数

numpy里面常用的函数

相关文章:

  • 2021-10-16
  • 2021-08-25
  • 2021-04-19
  • 2021-11-19
  • 2022-12-23
  • 2021-05-26
  • 2022-01-05
  • 2022-02-24
猜你喜欢
  • 2021-07-03
  • 2021-06-18
相关资源
相似解决方案