码迷,mamicode.com
首页 > 编程语言 > 详细

python中多维数组ndarray合并

时间:2014-09-12 01:18:32      阅读:396      评论:0      收藏:0      [点我收藏+]

标签:python   合并   

http://blog.csdn.net/pipisorry/article/details/39215089

numpy中ndarray的多维度上的合并

实现matlab data1=[r.*cos(t),r.*sin(t)];的功能:



实现matlab  data=[data1;data2];的功能


data_pos =

 [[-0.00870993  0.84913981]
 [-0.28528784  0.2612078 ]
 [-0.4475744   0.43677346]
 [-0.2473318  -0.89767194]
 [ 0.45242961 -0.02112013]
 [-0.10939665 -0.67678242]
 [ 0.59871918 -0.27938622]
 [-0.67484345  0.18797474]
 [ 0.04628507 -0.14074493]
 [ 0.27405096  0.91563243]]


data_neg = 

[[-1.7135893  -0.13973792]
 [-1.69338611  0.4599861 ]
 [ 0.4576769   1.68156328]
 [ 0.1199849  -1.00716347]
 [ 0.94074345  1.03022516]
 [-0.68055284 -1.84048252]
 [ 1.35995126  0.11136057]
 [ 1.04061602  0.89650711]
 [-1.79624533  0.27777414]
 [ 0.78416735  1.47684656]]


data = np.append(data_pos, data_neg, axis = 0)


data =

[[ -5.96464404e-01   4.06034396e-01]
 [  4.82952945e-01  -1.20121194e-01]
 [ -5.77977122e-01  -3.79254316e-01]
 [ -7.38540595e-01   5.30272266e-01]
 [  1.51701741e-01  -2.33477263e-01]
 [ -3.35472827e-04   4.38564615e-01]
 [ -9.62188462e-01   2.36012802e-01]
 [  5.44815124e-01  -5.36231442e-01]
 [ -2.76687718e-01  -3.30882444e-01]
 [  2.29255115e-01  -5.06503177e-01]
 [  3.26605661e-01  -1.86522383e+00]
 [  5.96712043e-01   1.46382588e+00]
 [  1.67364905e+00   9.05077496e-01]
 [ -1.48502012e+00  -3.60574944e-01]
 [ -1.44121871e+00  -1.33299063e+00]
 [  1.39996884e+00   1.79711008e-01]
 [ -6.82403150e-02  -1.53043305e+00]
 [  4.25909366e-01  -1.10527802e+00]
 [ -7.00656660e-01   8.22864651e-01]
 [ -6.55652372e-01  -1.80101194e+00]]


from:http://blog.csdn.net/pipisorry/article/details/39215089



python中多维数组ndarray合并

标签:python   合并   

原文地址:http://blog.csdn.net/pipisorry/article/details/39215089

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!