numpy的copy

numpy的copy函数和引用不用,引用的话当原变量改变,引用也改变,copy得到的变量则不受此影响。

Examples
    --------
    Create an array x, with a reference y and a copy z:
    
    >>> x = np.array([1, 2, 3])
    >>> y = x
    >>> z = np.copy(x)
    
    Note that, when we modify x, y changes, but not z:
    
    >>> x[0] = 10
    >>> x[0] == y[0]
    True
    >>> x[0] == z[0]
    False

 

posted on 2017-10-24 10:48  vyouman  阅读(1174)  评论(0)    收藏  举报