码迷,mamicode.com
首页 > 其他好文 > 详细

ndarray中的list转换为tuple

时间:2014-09-12 22:10:24      阅读:184      评论:0      收藏:0      [点我收藏+]

标签:numpy

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

import numpy as np

if __name__ == '__main__':    
    data = np.array(
        [[ 0.22403094,  0.08515318],
        [ 0.7529882 , -0.65134297],
        [ 0.61892283,  0.41210963],
        [ 0.06929629,  0.47723134],
        [ 0.79956486, -0.07013203],
        [ 0.03099718, -0.4212289 ],
        [ 0.05820561,  0.48054592],
        [-0.60840746,  0.34122053],
        [ 0.63020537, -0.10531408],
        [-0.38753049,  0.42978114],
        [ 1.74156634, -0.89196103],
        [-0.78990549, -1.30808011],
        [ 1.41932625,  0.89524238],
        [-1.51373298,  1.01396118],
        [-1.03842655, -1.10150947],
        [-1.08562109, -1.40299042],
        [-1.36879413,  1.04709953],
        [ 1.37326528,  0.37775816],
        [ 1.41298052,  0.94194292],
        [-0.45589253, -1.00021018]]
                            )
    print(data)
    data = data.T
    data = zip(data[0], data[1])
    print(data)


from:

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

ref:

http://blog.csdn.net/ssw_1990/article/details/23249373

ndarray中的list转换为tuple

标签:numpy

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

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