python】【numpy】【给多维矩阵添加一列】

转自:https://blog.csdn.net/tangdai0228/article/details/79639543

问题:

有一个数据m*n的numpy矩阵;现在给她加上一列变成一个m(n+1)的矩阵【多维通用】



方法:



 

引用:https://www.cnblogs.com/MrLJC/p/4823499.html


我的实际操作:

    1.使用 12*471*18*9维度的数据 

    2.reshape成 12*471*162

    3.添加一行bias 1 

x_train = np.reshape(x , (12,471,162))
"""
多维数据添加行
"""
x_train = np.c_[np.ones((12,471,1)) , x_train ]

猜你喜欢

转载自blog.csdn.net/orangefly0214/article/details/80934008
今日推荐