numpy中np.c_[]用法
np.c_[array1, array2] #把数组array1和数组array2配对后输出
np.c_[]用法
import numpy as np #导入numpy模块
a, b = np.mgrid[1:4:1, 2:3:1] #用mgrid()方法生成等差数组a,b
c_ = np.c_[a, b] #使用numpy中c_[]方法将数组a和数组b配对后输出
print("a:",a,"\n","b:",b) #打印a,b
print("c_:", c_)
结果为:
a: [[1]
[2]
[3]]
b: [[2]
[2]
[2]]
c_: [[1 2]
[2 2]
[3 2]]