爽歪歪666
不以物喜,不以己悲,努力才是永恒的主题。
 1 def fun_ndarray():
 2     a = [[1,2,7],
 3          [-6,-2,-3],
 4          [-4,-8,-55]
 5          ]
 6     b = [3,5,6]
 7     a = np.array(a)
 8     b = np.array(b)
 9     a_b_column = np.column_stack((a,b))#左右根据列拼接
10     a_b_row = np.row_stack((a,b))#上下按照行拼接
11     print('a_b_column')
12     print(a_b_column)
13     print('a_b_row')
14     print(a_b_row)

结果:

note:

column_stack,row_stack函数参数是一个元组

np.delete():删除行或列

 

data = np.delete(data,3,axis=1) # 删除第四列

 

posted on 2019-08-20 09:05  爽歪歪666  阅读(5470)  评论(0编辑  收藏  举报